投稿日 | : 2003/07/15(Tue) 19:30 |
投稿者 | : 魔界の仮面弁士 |
Eメール | : |
URL | : |
タイトル | : Re: ドラッグアンドドロップについて |
> VB6で、フォームを短形に選択し、
こういう事でしょうか?
Option Explicit
Private BX1 As Single
Private BY1 As Single
Private BX2 As Single
Private BY2 As Single
Private Sub Form_Load()
AutoRedraw = True
DrawMode = vbXorPen
DrawStyle = vbDot
ForeColor = BackColor
End Sub
Private Sub Form_MouseDown(Button%, Shift%, X!, Y!)
If Button = vbLeftButton Then
BX1 = X
BY1 = Y
BX2 = X
BY2 = Y
End If
End Sub
Private Sub Form_MouseMove(Button%, Shift%, X!, Y!)
If Button = vbLeftButton Then
Line (BX1, BY1)-(BX2, BY2), , B
BX2 = X
BY2 = Y
Line (BX1, BY1)-(BX2, BY2), , B
End If
End Sub
Private Sub Form_MouseUp(Button%, Shift%, X!, Y!)
If Button = vbLeftButton Then
'以下をコメントにすると、矩形が残ったままになる
Line (BX1, BY1)-(BX2, BY2), , B
End If
End Sub