f***@gmail.com
2013-07-05 12:05:54 UTC
Hello ,
I am writing at the same place on a picture box , a line with drawline and a text with drawstring ,
when i change the size of the picture box (the picture box has then a greater area than the form windows , line and text are no more displayed at the same location.
I am rather surprised.
Here is the code
Dim start As New Point(100, 100)
Dim start1_main As New Point(100, 50)
Dim start1 As New Point(50, 50)
Dim [end] As New Point(Me.ClientSize)
Dim my_rect As New Rectangle
Dim paintee As Control = DirectCast(sender, Control)
'Translate the points relative to the control being painted.
start = paintee.PointToClient(Me.PointToScreen(start))
start1_main = paintee.PointToClient(Me.PointToScreen(start))
start1 = paintee.PointToClient(Me.PointToScreen(start))
[end] = paintee.PointToClient(Me.PointToScreen([end]))
e.Graphics.DrawLine(Pens.Black, start, [end])
e.Graphics.DrawString(displaycomm_main, objpolice1_main, System.Drawing.Brushes.Yellow, start)
FRanck serval
I am writing at the same place on a picture box , a line with drawline and a text with drawstring ,
when i change the size of the picture box (the picture box has then a greater area than the form windows , line and text are no more displayed at the same location.
I am rather surprised.
Here is the code
Dim start As New Point(100, 100)
Dim start1_main As New Point(100, 50)
Dim start1 As New Point(50, 50)
Dim [end] As New Point(Me.ClientSize)
Dim my_rect As New Rectangle
Dim paintee As Control = DirectCast(sender, Control)
'Translate the points relative to the control being painted.
start = paintee.PointToClient(Me.PointToScreen(start))
start1_main = paintee.PointToClient(Me.PointToScreen(start))
start1 = paintee.PointToClient(Me.PointToScreen(start))
[end] = paintee.PointToClient(Me.PointToScreen([end]))
e.Graphics.DrawLine(Pens.Black, start, [end])
e.Graphics.DrawString(displaycomm_main, objpolice1_main, System.Drawing.Brushes.Yellow, start)
FRanck serval