VB6.0用掲示板の過去のログ(No.1)−VBレスキュー(花ちゃん)
[記事リスト] [新規投稿] [新着記事] [ワード検索] [過去ログ] [管理用]

投稿日: 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


- 関連一覧ツリー (★ をクリックするとツリー全体を一括表示します)

- 返信フォーム (この記事に返信する場合は下記フォームから投稿して下さい)

- Web Forum -