Skip to content

Commit bdc3131

Browse files
committed
Version 3.13.5.0
1 parent e38b6ce commit bdc3131

7 files changed

Lines changed: 30 additions & 11 deletions

File tree

CapsLockIndicatorV3/BetterCheckBox.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,20 @@ public BetterCheckBox() : base()
4444
SetStyle(ControlStyles.SupportsTransparentBackColor, true);
4545
}
4646

47+
protected override void OnMouseDown(MouseEventArgs mevent)
48+
{
49+
base.OnMouseDown(mevent);
50+
if (_darkMode)
51+
Invalidate();
52+
}
53+
54+
protected override void OnMouseUp(MouseEventArgs mevent)
55+
{
56+
base.OnMouseUp(mevent);
57+
if (_darkMode)
58+
Invalidate();
59+
}
60+
4761
protected override void OnPaint(PaintEventArgs e)
4862
{
4963
var bgColor = Parent?.BackColor ?? BackColor;
@@ -63,7 +77,7 @@ protected override void OnPaint(PaintEventArgs e)
6377
}
6478
else
6579
{
66-
var scaling = DPIHelper.GetScalingFactorPercent();
80+
var scaling = DPIHelper.GetScalingFactorPercent(Handle);
6781
var border = N_Border;
6882
var background = N_Background;
6983
var check = N_Check;

CapsLockIndicatorV3/BetterTabControl.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ protected override void OnCreateControl()
419419
base.OnCreateControl();
420420

421421
FindUpDown();
422+
ItemSize = new Size(ItemSize.Width, (int)(24 * DPIHelper.GetScalingFactorPercent(Handle)));
422423
}
423424

424425
private void FlatTabControl_ControlAdded(object sender, ControlEventArgs e)

CapsLockIndicatorV3/DPIHelper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ private enum DeviceCap
2020
DESKTOPVERTRES = 117
2121
}
2222

23-
internal static decimal GetScalingFactorPercent()
23+
internal static decimal GetScalingFactorPercent(IntPtr handle)
2424
{
25-
var g = Graphics.FromHwnd(IntPtr.Zero);
25+
var g = Graphics.FromHwnd(handle);
2626
try
2727
{
2828
var desktop = g.GetHdc();

CapsLockIndicatorV3/IconPackBrowser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ private void IconPackBrowser_DarkModeChanged(object sender, EventArgs e)
244244

245245
ControlScheduleSetDarkMode(webBrowser1, dark);
246246

247-
webBrowser1.Navigate("https://cli.jonaskohl.de/icongallery/embedded.php?dark=" + (dark ? "true" : "false") + "&scale=" + ((int)(DPIHelper.GetScalingFactorPercent() * 100)).ToString());
247+
webBrowser1.Navigate("https://cli.jonaskohl.de/icongallery/embedded.php?dark=" + (dark ? "true" : "false") + "&scale=" + ((int)(DPIHelper.GetScalingFactorPercent(Handle) * 100)).ToString());
248248
}
249249
}
250250
}

CapsLockIndicatorV3/IndicatorOverlay.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ public partial class IndicatorOverlay : Form
2525
static extern int GetWindowLongInt(IntPtr hWnd, int nIndex);
2626
[DllImport("user32.dll")]
2727
static extern int SetWindowLong(IntPtr hWnd, int nIndex, uint dwNewLong);
28-
[DllImport("user32.dll")]
29-
static extern int GetDpiForWindow(IntPtr hWnd);
28+
//[DllImport("user32.dll")]
29+
//static extern int GetDpiForWindow(IntPtr hWnd);
3030

31+
/*
3132
static float GetDisplayScaleFactor(IntPtr windowHandle)
3233
{
3334
try
@@ -39,6 +40,7 @@ static float GetDisplayScaleFactor(IntPtr windowHandle)
3940
return 1;
4041
}
4142
}
43+
*/
4244

4345
const int GWL_EXSTYLE = -20;
4446
const uint WS_EX_LAYERED = 0x80000;
@@ -111,7 +113,7 @@ void UpdatePosition()
111113
{
112114
Rectangle workingArea = Screen.GetWorkingArea(Cursor.Position);
113115

114-
var factor = GetDisplayScaleFactor(Handle);
116+
//var factor = DPIHelper.GetScalingFactorPercent(Handle);
115117

116118
Size = new Size(
117119
Width,
@@ -167,8 +169,10 @@ protected override void OnPaint(PaintEventArgs e)
167169
{
168170
base.OnPaint(e);
169171

172+
var factor = DPIHelper.GetScalingFactorPercent(Handle);
173+
170174
if (BorderSize > 0)
171-
e.Graphics.DrawRectangle(new Pen(BorderColour, BorderSize), e.ClipRectangle);
175+
e.Graphics.DrawRectangle(new Pen(BorderColour, (int)(BorderSize * factor)), e.ClipRectangle);
172176

173177
using (var sf = new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center })
174178
using (var b = new SolidBrush(contentLabel.ForeColor))

CapsLockIndicatorV3/MainForm.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ public MainForm()
235235
private void TabControl1_SelectedIndexChanged(object sender, EventArgs e)
236236
{
237237
var sz = ClientSize;
238-
sz.Height = (int)(int.Parse(tabControl1.SelectedTab.Tag.ToString()) * DPIHelper.GetScalingFactorPercent());
238+
sz.Height = (int)(int.Parse(tabControl1.SelectedTab.Tag.ToString()) * DPIHelper.GetScalingFactorPercent(Handle));
239239
ClientSize = sz;
240240
}
241241

CapsLockIndicatorV3/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@
2424
//
2525
// You can specify all the values or you can use the default the Revision and
2626
// Build Numbers by using the '*' as shown below:
27-
[assembly: AssemblyVersion("3.13.4.0")]
28-
[assembly: AssemblyFileVersion("3.13.4.0")]
27+
[assembly: AssemblyVersion("3.13.5.0")]
28+
[assembly: AssemblyFileVersion("3.13.5.0")]
2929
[assembly: Guid ("6f54c357-0542-4d7d-9225-338bc3cd7834")]

0 commit comments

Comments
 (0)