Nasty2
May 31st, 2005, 01:23 PM
hey guys, i got 2 problems,
1. i want the user to click on a form and the app. must draw a GroupBox at that location with a Label inside it.
All that shows on screen is the GroupBox...... i am bringing the label to the front but its still not showing.
The code I tried out is as follows:
Private l As New Label
Private g As New GroupBox
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
Dim q As System.Drawing.Point
q.X = e.X
q.Y = e.Y
g.Location = q
g.Text = ""
Me.Controls.Add(g)
l.Parent = g
l.Dock = DockStyle.Fill
l.Text = Me.TextBox1.Text
l.TextAlign = ContentAlignment.MiddleCenter
l.BringToFront()
l.Visible = True
Me.Controls.Add(l)
End Sub
2. How can I draw a line from one control to another? I would like the user to click on 2 controls...... a line will be created from the edge of one to the other.
Thanks in advance for your advice
1. i want the user to click on a form and the app. must draw a GroupBox at that location with a Label inside it.
All that shows on screen is the GroupBox...... i am bringing the label to the front but its still not showing.
The code I tried out is as follows:
Private l As New Label
Private g As New GroupBox
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
Dim q As System.Drawing.Point
q.X = e.X
q.Y = e.Y
g.Location = q
g.Text = ""
Me.Controls.Add(g)
l.Parent = g
l.Dock = DockStyle.Fill
l.Text = Me.TextBox1.Text
l.TextAlign = ContentAlignment.MiddleCenter
l.BringToFront()
l.Visible = True
Me.Controls.Add(l)
End Sub
2. How can I draw a line from one control to another? I would like the user to click on 2 controls...... a line will be created from the edge of one to the other.
Thanks in advance for your advice