none
制作闪烁的点? RRS feed

  • 问题

  • 制作闪烁的点,vb2003代码正确,不能达到效果。代码如下:

    对象和属性表
    checkbox    name    checkbox1
                       text      闪烁的点

    代码
    Module Module1

        Declare Function Flashrect1 Lib "user32" (ByVal hwnd As Integer, ByVal bInvert As Integer) As Integer

    End Module

     Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged

            Dim i As Object
            If CheckBox1.CheckState = 0 Then
                Timer1.Enabled = False
                i = Flashrect1(Me.Handle.ToInt32, 0)
            Else
                Timer1.Enabled = True
            End If
        End Sub

        Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
            Dim i As Object
            i = Flashrect1(Me.Handle.ToInt32, 1)
        End Sub

        Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
            Dim rect1 As Rectangle = Rectangle.FromLTRB(40, 40, 80, 80)
            Dim pen1 As Pen = New Pen(Color.Black)
            Dim brush1 As Brush= New SolidBrush(Color.FromArgb(100, Color.Black))
            e.Graphics.DrawEllipse(pen1, rect1)
            e.Graphics.FillEllipse(brush1, rect1)
       
        End Sub
    End Class


    visual studio 2008
    2009年3月6日 9:09

答案