2012年12月5日 星期三

示範兩個button的滑鼠拖曳

這程式示範兩個button的滑鼠拖曳
只要將buttonclass,buttonplat改成你的button 名稱就可用


Private Sub Buttonclass_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Buttonclass.MouseDown
        Timer1.Enabled = True
        Timer1.Start()
        objectposition = Buttonclass.Location
        cursorpoint = Cursor.Position
    End Sub
    Private Sub Buttonclass_Mouseup(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Buttonclass.MouseUp
        Timer1.Stop()
        objectposition = Buttonclass.Location
        cursorpoint = Cursor.Position
    End Sub
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Buttonclass.Location = objectposition - cursorpoint + Cursor.Position
    End Sub
   
Private Sub buttonplat_mousedown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Buttonplat.MouseDown
        Timer2.Enabled = True
        Timer2.Start()
        objectposition = Buttonplat.Location
        cursorpoint = Cursor.Position
    End Sub
  
 Private Sub buttonplat_mouseup(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Buttonplat.MouseUp
        Timer2.Stop()
        objectposition = Buttonplat.Location
        cursorpoint = Cursor.Position
    End Sub
   
    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        Buttonplat.Location = objectposition - cursorpoint + Cursor.Position
    End Sub
End Class

2012年12月3日 星期一

黃山農民工


DSC04951, originally uploaded by douglas0830.
黃山的農民工規定穿上綠背心
一路將山下物資一步步以扁擔挑上山