回覆列表
  • 1 # 快樂與我同行9

    在窗體上加入控制元件line1,然後複製下面程式碼,執行後在窗體上拖放滑鼠即可。

    OptionExplicit

    PrivateSubForm_Load()

    Me.AutoRedraw=True

    Line1.Visible=False

    EndSub

    PrivateSubForm_MouseDown(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)

    WithLine1

    .X1=X

    .Y1=Y

    .X2=X

    .Y2=Y

    .Visible=True

    EndWith

    EndSub

    PrivateSubForm_MouseMove(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)

    WithLine1

    IfButton=1Then

    .X2=X

    .Y2=Y

    EndIf

    EndWith

    EndSub

    PrivateSubForm_MouseUp(ButtonAsInteger,ShiftAsInteger,XAsSingle,YAsSingle)

    WithLine1

    IfButton=1Then

    .Visible=False

    Line(.X1,.Y1)-(.X2,.Y2)

    EndIf

    EndWith

    EndSub

  • 中秋節和大豐收的關聯?
  • 形容謹慎小心的成語?