xpoi5020 發表於 2016-5-3 19:32:35

冒出廣告實作

範例圖:


程式碼:Public Class Form1
    Dim MoveInt As Int64
    Dim Move2 As Int64
    Dim Move3 As Int64
    Dim Down As Int64 = My.Computer.Screen.WorkingArea.Height + Me.Size.Height
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.Location = New Point(My.Computer.Screen.Bounds.Width - Me.Size.Width, My.Computer.Screen.Bounds.Height + Me.Size.Height)
        MoveInt = My.Computer.Screen.Bounds.Height - My.Computer.Screen.WorkingArea.Height
        Move2 = MoveInt + Me.Size.Height
        Move3 = My.Computer.Screen.Bounds.Height - Move2
        MOve.Start()
    End Sub
    Private Sub MOve_Tick(sender As Object, e As EventArgs) Handles MOve.Tick
        If Move3 < Me.Location.Y Then
            Me.Location = New Point(Me.Location.X, Me.Location.Y - 5)
        Else
            Me.TopMost = True

            MOve.Stop()

        End If
    End Sub

    Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click
        Me.TopMost = False
        MOVEDOWN.Start()
    End Sub

    Private Sub MOVEDOWN_Tick(sender As Object, e As EventArgs) Handles MOVEDOWN.Tick
        If Down > Me.Location.Y Then
            Me.Location = New Point(Me.Location.X, Me.Location.Y + 5)
        Else

            End
            MOVEDOWN.Stop()
        End If
    End Sub

    Private Sub PictureBox1_Click(sender As Object, e As EventArgs) Handles PictureBox1.Click

    End Sub
End ClassMOve跟MOVEDOWN 是Timer
Interval 都是1


頁: [1]
查看完整版本: 冒出廣告實作