ALX
Well-known member
When drawing graphics at a particular point, using a control's location or PointToScreen function, there are a few pixels difference between the actual locations that the graphics object appears on the screen when running the code within the IDE and in the compiled version. Is this the norm or is there a problem with my logic here? I'm just making a label flash when it gets clicked...
In an inherited form, there is a panel(NavPanel1) that contains a label(UpLabel)...
And the base class form method that handles this call...
When running in the IDE, everything is perfect. In the compiled version, It paints the white rectangle about 3 or 4 pixels too high & to the left. I could compensate for this by adding values to rect's location, but I figured that I messed up somewhere. ????
In an inherited form, there is a panel(NavPanel1) that contains a label(UpLabel)...
VB.NET:
CFlash(New Rectangle(NavPanel1.PointToScreen(New Point(UpLabel.Location)), UpLabel.Size))
And the base class form method that handles this call...
VB.NET:
Friend Sub CFlash(ByRef rect As Rectangle)
G = Me.CreateGraphics
G.FillRectangle(Brushes.White, rect) ' Paint the label white
System.Threading.Thread.Sleep(80) ' Wait briefly
Me.Refresh() ' Remove the white rectangle
End Sub
When running in the IDE, everything is perfect. In the compiled version, It paints the white rectangle about 3 or 4 pixels too high & to the left. I could compensate for this by adding values to rect's location, but I figured that I messed up somewhere. ????