Hi,

I posted a code below of a Form that Draw and FillColor a Rectangle using a Menu.

Anyone can help me use 2 classes (CRectangle, CColorRectangle) to Draw and FillColor a Rectangle?

It works using Form but when I tried doing it using classes I couldnt get it to draw nor fillcolor. I am a beginner and a student on VB.NET.


Any help will be much appreciated. Thanks a lot.

_____
Zac
--------

-------------------------------------------------------------------

Public Class Rectangle
Inherits System.Windows.Forms.Form
Private RX As Integer
Private RY As Integer
Private RWidth As Integer
Private RHeight As Integer




#Region " Windows Form Designer generated code "


#End Region



Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
'Dim MyCRec As Object

RX = InputBox("Enter X Value: ", "X Value")
RY = InputBox("Enter Y Value: ", "Y Value")
RWidth = InputBox("Enter Width Value: ", "Width Value")
RHeight = InputBox("Enter Height Value: ", "Height Value")

Dim graphicsObject As Graphics = Me.CreateGraphics
Dim MyPen As Pen = New Pen(Color.Red, 1)
Dim MyRec As Rectangle = New Rectangle()

graphicsObject.DrawRectangle(MyPen, RX, RY, RWidth, RHeight)

End Sub

Private Sub MenuItem3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem3.Click

Dim graphicsObject As Graphics = Me.CreateGraphics
Dim redBrush As New SolidBrush(Color.Red)
graphicsObject.FillRectangle(redBrush, RX, RY, RWidth, RHeight)



End Sub
End Class