T
tneon1
Guest
Hello,
I created a user control and am adding multiple instances of the control to my main form. When I set the control location properties the property changes as soon as the form.controls.add(control) is executed to a value I am not setting. I am not sure why this is happening. I have attached the code I am using.
Private Sub SetupTriaxisScrn(LocalSpc As Int32)
Dim AtLoop As Int32 = 0
Dim MoveLoop As Int32 = 0
Dim lSpace As Integer = 0
Dim lAxisControl As AxisControl = New AxisControl
Dim ctlTop As Int32 = grpHeader.Top + grpHeader.Height
Static TotalMoves As Int32 = 0
For AtLoop = 0 To MaxAxisType - 6
Select Case AtLoop
Case 0
For MoveLoop = 0 To 1
TotalMoves += 1
'lAxisControl.Clear()
'lAxisControl.lblName.Text = AxisSetup(AtLoop). + " " + MoveLoop.ToString
'lAxisControl.lblName.Visible = True
lAxisControl.Top = ctlTop
lAxisControl.Width = AxisWidth
lAxisControl.AxisType = AtLoop
lAxisControl.MoveNumber = TotalMoves
lAxisControl.Setposition(Me.Label2, lAxisControl.cmbAxisType)
AxisList.Add(lAxisControl)
lAxisControl.Visible = False
Me.Controls.Add(AxisList(MoveLoop))
Dim Index As Integer = AxisList.Count
ctlTop = lAxisControl.Top + lAxisControl.Height + LocalSpc
lAxisControl.Visible = True
Next
lSpace = AxisList(AxisList.Count - 1).Top + LocalSpc
' Add a line
DrawLine(Me, 3, lSpace, AxisWidth, lSpace)
lSpace += LocalSpc
Case 1
End Select
Next
End Sub
Continue reading...
I created a user control and am adding multiple instances of the control to my main form. When I set the control location properties the property changes as soon as the form.controls.add(control) is executed to a value I am not setting. I am not sure why this is happening. I have attached the code I am using.
Private Sub SetupTriaxisScrn(LocalSpc As Int32)
Dim AtLoop As Int32 = 0
Dim MoveLoop As Int32 = 0
Dim lSpace As Integer = 0
Dim lAxisControl As AxisControl = New AxisControl
Dim ctlTop As Int32 = grpHeader.Top + grpHeader.Height
Static TotalMoves As Int32 = 0
For AtLoop = 0 To MaxAxisType - 6
Select Case AtLoop
Case 0
For MoveLoop = 0 To 1
TotalMoves += 1
'lAxisControl.Clear()
'lAxisControl.lblName.Text = AxisSetup(AtLoop). + " " + MoveLoop.ToString
'lAxisControl.lblName.Visible = True
lAxisControl.Top = ctlTop
lAxisControl.Width = AxisWidth
lAxisControl.AxisType = AtLoop
lAxisControl.MoveNumber = TotalMoves
lAxisControl.Setposition(Me.Label2, lAxisControl.cmbAxisType)
AxisList.Add(lAxisControl)
lAxisControl.Visible = False
Me.Controls.Add(AxisList(MoveLoop))
Dim Index As Integer = AxisList.Count
ctlTop = lAxisControl.Top + lAxisControl.Height + LocalSpc
lAxisControl.Visible = True
Next
lSpace = AxisList(AxisList.Count - 1).Top + LocalSpc
' Add a line
DrawLine(Me, 3, lSpace, AxisWidth, lSpace)
lSpace += LocalSpc
Case 1
End Select
Next
End Sub
Continue reading...