投稿日 | : 2007/04/06(Fri) 15:12 |
投稿者 | : Edward |
Eメール | : |
URL | : |
タイトル | : Re^3: PictureBox上のLineを回転させる方法 |
Formの中に
コマンドボタン一つと
ピクチャーボックス一つと
その中にライン一つ配置して
以下のコードでどうでしょう?
Option Explicit
Dim BT_CAPTION(4) As String
Private Sub Command1_Click()
Select Case Command1.Caption
Case BT_CAPTION(0)
Line1.X2 = Line1.X1 + 1000
Line1.Y2 = Line1.Y1
Command1.Caption = BT_CAPTION(1)
Case BT_CAPTION(1)
Line1.X2 = Line1.X1
Line1.Y2 = Line1.Y1 + 1000
Command1.Caption = BT_CAPTION(2)
Case BT_CAPTION(2)
Line1.X2 = Line1.X1 - 1000
Line1.Y2 = Line1.Y1
Command1.Caption = BT_CAPTION(3)
Case BT_CAPTION(3)
Line1.X2 = Line1.X1
Line1.Y2 = Line1.Y1 - 1000
Command1.Caption = BT_CAPTION(0)
End Select
End Sub
Private Sub Form_Load()
BT_CAPTION(0) = " 0 → 90"
BT_CAPTION(1) = " 90 → 180"
BT_CAPTION(2) = "180 → 270"
BT_CAPTION(3) = "270 → 0"
Line1.X1 = Picture1.Width / 2
Line1.Y1 = Picture1.Height / 2
Command1.Caption = BT_CAPTION(0)
End Sub