mirror of
https://github.com/jkocon/g-helper.git
synced 2026-02-23 13:00:52 +01:00
Possible fix for theme switching
This commit is contained in:
@@ -18,25 +18,29 @@ namespace CustomControls
|
||||
[DllImport("DwmApi")] //System.Runtime.InteropServices
|
||||
private static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, int[] attrValue, int attrSize);
|
||||
|
||||
public bool darkTheme;
|
||||
public bool invert = false;
|
||||
public bool darkTheme = false;
|
||||
|
||||
public void InitTheme()
|
||||
public void InitTheme(bool setDPI = true)
|
||||
{
|
||||
bool newDarkTheme = CheckSystemDarkModeStatus();
|
||||
invert = (darkTheme != newDarkTheme);
|
||||
bool changed = (darkTheme != newDarkTheme);
|
||||
darkTheme = newDarkTheme;
|
||||
|
||||
ControlHelper.Adjust(this, 2, invert);
|
||||
try
|
||||
{
|
||||
DwmSetWindowAttribute(this.Handle, 20, new[] { darkTheme ? 1 : 0 }, 4);
|
||||
} catch { }
|
||||
if (setDPI)
|
||||
ControlHelper.Resize(this);
|
||||
|
||||
DwmSetWindowAttribute(this.Handle, 20, new[] { darkTheme ? 1 : 0 }, 4);
|
||||
ControlHelper.Adjust(this, darkTheme, changed);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class RTrackBar : TrackBar
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class RComboBox : ComboBox
|
||||
{
|
||||
private Color borderColor = Color.Gray;
|
||||
@@ -224,10 +228,10 @@ namespace CustomControls
|
||||
private int borderRadius = 5;
|
||||
|
||||
private bool activated = false;
|
||||
private bool secondary = false;
|
||||
|
||||
private Color borderColor = Color.Transparent;
|
||||
|
||||
|
||||
public Color BorderColor
|
||||
{
|
||||
get { return borderColor; }
|
||||
@@ -250,6 +254,14 @@ namespace CustomControls
|
||||
}
|
||||
}
|
||||
|
||||
public bool Secondary
|
||||
{
|
||||
get { return secondary; }
|
||||
set
|
||||
{
|
||||
secondary = value;
|
||||
}
|
||||
}
|
||||
|
||||
public RButton()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user