Hello everyone,
I create a class to draw a rectangle which contains a string. It is like a label.
Here is the class that I have created:
I am wondering that if there is a way to add events to it. For example, if I clicked on certain rectangle, it will show a message box to tell me the color,location of the rectangle.
Thank you.
I create a class to draw a rectangle which contains a string. It is like a label.
Here is the class that I have created:
VB.NET:
Public Class DrawingBlock
Private Draw As Graphics
Public Sub New(ByVal point As Point, ByVal parentObj As Object, ByVal pen As Pen, ByVal brush As Brush, ByVal printString As String)
Dim Rect As New Rectangle(point, RectSize)
Draw = parentObj.CreateGraphics
Draw.DrawRectangle(pen, Rect)
Draw.DrawString(printString, New Font("Arial", 15), brush, New Point(point.X + 3, point.Y + 3))
End Sub
End Class
Thank you.