@@ -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 ) )
0 commit comments