Labelの選択
投稿者 なっちゃん  (中学生)
投稿日時
2011/4/30 17:25:46
Labelの文字をドラッグ出来るようにする方法はありますか?
投稿者 O-157  (その他)
投稿日時
2011/4/30 19:01:40
これでいけます。
Public Class Form1
Dim oldlocation As Point
Dim oldposition As Point
Private Sub Label1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label1.MouseDown
oldposition = Cursor.Position
oldlocation = Label1.Location
Timer1.Enabled = True
Timer1.Tag = True
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If Timer1.Tag = True Then
Label1.Location = New Point(oldlocation.X + Cursor.Position.X - oldposition.X, oldlocation.Y + Cursor.Position.Y - oldposition.Y)
End If
End Sub
Private Sub Label1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label1.MouseUp
Timer1.Enabled = False
Timer1.Tag = False
End Sub
End Class
投稿者 shu  (社会人)
投稿日時
2011/4/30 21:54:55
TextBoxをReadOnlyにするのは駄目ですか?