Skip to content

Commit

Permalink
fix(windows): System dark theme not applying to title bar
Browse files Browse the repository at this point in the history
  • Loading branch information
lulzsun committed Oct 30, 2024
1 parent f95fdf8 commit 4986414
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Classes/WindowsInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Windows.Forms;
Expand All @@ -22,6 +23,15 @@ public partial class WindowsInterface : Form {
public static WindowsInterface Instance;
private static Socket listener;

[DllImport("DwmApi")]
private static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, int[] attrValue, int attrSize);

// https://stackoverflow.com/a/64927217
protected override void OnHandleCreated(EventArgs e) {
if (DwmSetWindowAttribute(Handle, 19, new[] { 1 }, 4) != 0)
DwmSetWindowAttribute(Handle, 20, new[] { 1 }, 4);
}

public WindowsInterface() {
Instance = this;
InitializeComponent();
Expand Down

0 comments on commit 4986414

Please sign in to comment.