Dynamic Controls
Hi,
I am building a simple drag and drop interface to drop controls such as Textbox, Checkbox and Label onto a Frame. My code works fine for the textboxes and checkboxes but for the labels they get dropped behind the form, even though I the code is the same for each control (roughly) and the z-order is changed to put it in front (ie sitting on top but the form is the container not the frame). Any help would be great, Seem to be going round in circles;
Private Sub Frame1_DragDrop(Source As Control, X As Single, Y As Single)
...
If TypeOf Source Is Label Then
lblLabel(Source.Index).Top = Y
lblLabel(Source.Index).Left = X
If Source.Index = lblLabel.Count Then
Load lblLabel(lblLabel.Count + 1)
With lblLabel(lblLabel.Count)
.Visible = True
.Top = 1080
.Left = 6960
.ZOrder 0
.Caption = "Label" & lblLabel.Count
.Tag = lblLabel.Count
End With
End If
End If
...
End Sub
|