06-10-13, 03:06 PM
السلام عليكم تفضل جرب هذا الكود واعطيني رأيك
كود :
Dim WithEvents lbl As New Label
Dim b As Boolean = False
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
lbl.Text = "3booody"
Me.RichTextBox1.Controls.Add(lbl)
AddHandler lbl.DoubleClick, AddressOf lbl_DoubleClick
End Sub
Private Sub lbl_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs)
If b Then
b = False
lbl.ForeColor = Color.Black
Else
b = True
lbl.ForeColor = Color.Red
End If
End Sub
Private Sub RichTextBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles RichTextBox1.MouseMove
If b Then
lbl.Location = New Point(e.X, e.Y)
lbl.Refresh()
End If
End Sub
