Hi,
I want to draw some rectangle's on a user control.
I use this code:
Private Sub DrawRectangle()
Dim myRectangle As Rectangle
' myGraphics = Graphics.FromHwnd(hwnd:=.A
ctiveForm(
).Handle)
myGraphics = Graphics.FromHwnd(hwnd:=.A
ctiveContr
ol().Handl
e)
Dim nX As Integer
Dim nY As Integer
For nY = 1 To 300 Step 30
For nX = 1 To 150 Step 10
myRectangle = New Rectangle(nX, nY, Width:=30, Height:=10)
myGraphics.DrawRectangle(p
en:=New Pen(Color.Black), rect:=myRectangle)
Next
Next
End Sub
When i put it on a form there is no problem, when I put it on a usercontrol it's not working.
myGraphics = Graphics.FromHwnd(hwnd:=.A
ctiveContr
ol().Handl
e) give the problem. Any idea.
thnx
Start Free Trial