Hello, I have a question, I am working through classes.
I have created one class library project with a button class and in the mouse move event of the class I want to create some graphics to a picturebox background image. I thought to create another class library to the same project and I did it. But when I went to the mouse move event of the first class I became confused because I wanted a reference somehow to the other class that's a different control.
I wanted just to put this statement in my first class mouse move event
Dim g As System.Drawing.Graphics = BrdPB.CreateGraphics()
BrdPB is the name of the second class
So picturebox1 is not declared because it's another class in my project. Well, is it possible to make the first class to have an interface to the second (that is different because it's a picture box not a button) and how can I access the second class object through the first class? Shouldn't I have created the second class? What is the best way to do it? To declare the picture box into the first class and remove the second class? Or to do all the work in my windows form project?
I thought another way too. To create a public sub to the second class this one below. But I want to call that sub in the other class mouse move event and how? Or to create a handler to the MouseMoveChecker sub to the first class but what???
Any opinions or suggestions please???
Public Sub MouseMoveChecker()
LoadCoords()
cnt = cnt + 1
If cnt = 1 Then
Dim points(CType(keyCoords(0), ArrayList).Count - 1) As Point
For i As Integer = 0 To CType(keyCoords(0), ArrayList).Count - 1
points(i) = CType(CType(keyCoords(0), ArrayList)(i), Point)
Next
Dim g As System.Drawing.Graphics = Me.CreateGraphics()
Dim brsh As New SolidBrush(Color.FromArgb(130, 255, 255, 0))
g.FillPolygon(brsh, points)
brsh.Dispose()
g.Dispose()
End If
End Sub
Any help will much appreciated.
I have created one class library project with a button class and in the mouse move event of the class I want to create some graphics to a picturebox background image. I thought to create another class library to the same project and I did it. But when I went to the mouse move event of the first class I became confused because I wanted a reference somehow to the other class that's a different control.
I wanted just to put this statement in my first class mouse move event
Dim g As System.Drawing.Graphics = BrdPB.CreateGraphics()
BrdPB is the name of the second class
So picturebox1 is not declared because it's another class in my project. Well, is it possible to make the first class to have an interface to the second (that is different because it's a picture box not a button) and how can I access the second class object through the first class? Shouldn't I have created the second class? What is the best way to do it? To declare the picture box into the first class and remove the second class? Or to do all the work in my windows form project?
I thought another way too. To create a public sub to the second class this one below. But I want to call that sub in the other class mouse move event and how? Or to create a handler to the MouseMoveChecker sub to the first class but what???
Any opinions or suggestions please???
Public Sub MouseMoveChecker()
LoadCoords()
cnt = cnt + 1
If cnt = 1 Then
Dim points(CType(keyCoords(0), ArrayList).Count - 1) As Point
For i As Integer = 0 To CType(keyCoords(0), ArrayList).Count - 1
points(i) = CType(CType(keyCoords(0), ArrayList)(i), Point)
Next
Dim g As System.Drawing.Graphics = Me.CreateGraphics()
Dim brsh As New SolidBrush(Color.FromArgb(130, 255, 255, 0))
g.FillPolygon(brsh, points)
brsh.Dispose()
g.Dispose()
End If
End Sub
Any help will much appreciated.