Hi all,
New to graphics.
I'm sure this is a simple question. I want to create a class that
I can pass in a control or form and it will draw an rectangle on that object
that I pass in to the class.
I know the code is wrong that I'm posting, can someone please help. I think
looking at the below code you
will understand what I want to do. Of course it doesn't work. I would like
to have a class that draws a rectangle and
fill it with some color and have it in a timer that moves it or redraws it
across the object\control. And using it's on thread
thanks for any help
Imports System.Drawing
Public Class DrawCls
Public Sub Draw(ByVal Cnt As Object)
Dim g As Graphics
Dim pen As Pen = New Pen(Color.Green)
g.DrawLine(pen, 4, 4, 100, 100)
End Sub
End Class
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim Dw As DrawCls
Dw = New DrawCls
Dw.Draw(Me)
End Sub
gv
Bob Powell [MVP] - 29 Apr 2005 20:14 GMT
You need to be reading the GDI+ FAQ.
Search for "retained mode" on my site.

Signature
Bob Powell [MVP]
Visual C#, System.Drawing
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
> Hi all,
>
[quoted text clipped - 35 lines]
>
> gv
gv - 29 Apr 2005 21:22 GMT
Thanks
great site!!!!!
I have one question. For example once I draw something in a button click
event..
Before I click and draw again but in a different location how do I get rid
of the previous graphic?
thanks
Gerry
> You need to be reading the GDI+ FAQ.
>
[quoted text clipped - 39 lines]
>>
>> gv