i have to click a button and draw a rectangle in vb.net form like wise drawing a rectangle in painbrush..give me sample coding
draw a rectangle
Collapse
X
-
Ok your button isn't included here sorry, it was a bit complex to me(i'm a bit noobie here) so you can figure out yourself anothe way or make it with the button. anyway, here's the code to draw the rect:
Public Class Form1
Dim r As New Rectangle(100, 100, 100, 50) 'the rectangle to fill
Private Sub Form1_Paint(ByV al sender As Object, ByVal e As System.Windows. Forms.PaintEven tArgs) Handles Me.Paint
Dim g As Graphics = e.Graphics 'graphics class
g.FillRectangle (Brushes.Black, r) 'draw it
End Sub
End Class
Learned anything? ok, that's it for now. if you want i post more gdi+ help so only ask me.
Comment