Skip to content

Commit 91c6291

Browse files
committed
Fix: Almost always windows have white border
1 parent 2a418eb commit 91c6291

File tree

7 files changed

+2
-9
lines changed

7 files changed

+2
-9
lines changed

.vs/QuickLibrary/v16/.suo

0 Bytes
Binary file not shown.

QuickLibrary/QlibFixedForm.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ protected override void OnLoad(EventArgs e)
205205

206206
protected override void OnHandleCreated(EventArgs e)
207207
{
208+
ThemeMan.EnableDarkTitlebar(Handle, DarkMode);
208209
(new DropShadow()).ApplyShadows(this);
209210
base.OnHandleCreated(e);
210211
}
@@ -286,8 +287,6 @@ private void CloseBtn_Click(object sender, EventArgs e)
286287

287288
private void SetDarkMode(bool dark, bool alternative)
288289
{
289-
HandleCreated += new EventHandler(ThemeMan.formHandleCreated);
290-
291290
darkMode = dark;
292291
alternativeAppearance = alternative;
293292

QuickLibrary/ThemeMan.cs

+1-7
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ private struct WindowCompositionAttribData
7777
[DllImport("user32.dll")]
7878
private static extern bool SetWindowCompositionAttribute(IntPtr hwnd, ref WindowCompositionAttribData data);
7979

80-
private static void enableDarkTitlebar(IntPtr handle, bool dark)
80+
public static void EnableDarkTitlebar(IntPtr handle, bool dark)
8181
{
8282
AllowDarkModeForWindow(handle, dark);
8383

@@ -100,12 +100,6 @@ public static void allowDarkModeForApp(bool dark)
100100
AllowDarkModeForApp(dark);
101101
}
102102

103-
public static void formHandleCreated(object sender, EventArgs e)
104-
{
105-
Form f = sender as Form;
106-
enableDarkTitlebar(f.Handle, true);
107-
}
108-
109103
public static void setDarkModeToControl(IntPtr handle)
110104
{
111105
SetWindowTheme(handle, "DarkMode_Explorer", null);
-512 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
-512 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)