Thanks for looking. I'm new to classes and can't work out where i've gone wrong.
In my Who Wants to be a Millionaire application, I have a Lifeline class and I create three instances of it - FF, PAF and ATA (50/50, Phone a Friend and Ask the Audience).
something i do with a lifeline is put a cross over its logo, hence the need for a centrepoint property, which marks the centre of the cross on a form.
There are two forms. The first one's code module calls on the second one's code module to draw a cross on the second form.
The second form creates the object when the app starts up:
The first form should take the FF object created by the second form and pas it to the second form to get the second form to draw a cross on itself:
Form 1:
Form 2:
What happens is that at the "Call Form2.DrawCross(Form2.CentrePoint)" line, the tooltip shows that the FF object's centrepoint property isn't set (as I thought it would be by " FF.CentrePoint = tmpPoint").
Could someone shed some light on why please?
In my Who Wants to be a Millionaire application, I have a Lifeline class and I create three instances of it - FF, PAF and ATA (50/50, Phone a Friend and Ask the Audience).
something i do with a lifeline is put a cross over its logo, hence the need for a centrepoint property, which marks the centre of the cross on a form.
VB.NET:
Public Class Lifeline
Private ptCentrePoint As Point
Public Property CentrePoint() As Point
Get
CentrePoint = ptCentrePoint
End Get
Set(ByVal Value As Point)
ptCentrePoint = Value
End Set
End Property
End Class
There are two forms. The first one's code module calls on the second one's code module to draw a cross on the second form.
The second form creates the object when the app starts up:
VB.NET:
Public FF As New Lifeline
Sub Form2_Load([etc])
'give the lifeline objects properties. 'a point is a structure. x and y can't be set directly
Dim tmpPoint As New System.Drawing.Point(50, 25)
FF.CentrePoint = tmpPoint
The first form should take the FF object created by the second form and pas it to the second form to get the second form to draw a cross on itself:
Form 1:
VB.NET:
Call Form2.DrawCross(Form2.FF.CentrePoint)
Form 2:
VB.NET:
Friend Sub DrawCross(ByVal ptIn As Point)
Dim pt1, pt2 As Point
pt1.X = ptIn.X + 20 '/starting x co-ordinate of first stroke
pt1.Y = ptIn.Y + 20 ' /starting y co-ordinate of first stroke
pt2.X = ptIn.X - 20 '/ending x co-ordinate of first stroke
pt2.Y = ptIn.Y - 20 '/ending y co-ordinate of first stroke
gphFormGraphics.DrawLine(myPen, pt1, pt2)
pt1.X = ptIn.X + 20 '\starting x co-ordinate of second stroke
pt1.Y = ptIn.Y - 20 '\starting y co-ordinate of second stroke
pt2.X = ptIn.X - 20 '\ending x co-ordinate of second stroke
pt2.Y = ptIn.Y + 20 '\ending y co-ordinate of second stroke
gphFormGraphics.DrawLine(myPen, pt1, pt2)
End Sub
What happens is that at the "Call Form2.DrawCross(Form2.CentrePoint)" line, the tooltip shows that the FF object's centrepoint property isn't set (as I thought it would be by " FF.CentrePoint = tmpPoint").
Could someone shed some light on why please?