我想做一个烟花的效果(用VB),有点类似蜘蛛牌过关后出现的那个效果。谁能帮我一下,真的很急。
先谢了。

解决方案 »

  1.   

    你他妈的有病呀。不是说得很清楚了吗?用VB做一个,不会做就别他妈的附和,真想不到这里面的人怎么都这样了呢?连点热心都没有了,让人气愤,让人失望。和我过去认识的CSDN完全不一样了。
      

  2.   

    MSTOP绝对的大好人,楼上的这样说?伤死人心了!
    MSTOP不要跟他计较!
      

  3.   

    煙花效果用js 容易實現,網上到處現成代碼。但是vb本身在處理這些問題上就不太好,效率不高。而且你問得問題不是一時三刻能解決得,每個人都有自己得事情,就那點分就要人幫還滿口臟話。算了。估計看你那話,再急都沒有誰理。
      

  4.   

    提個醒:少說臟話,洗洗嘴巴。
           你用 vc做你想要得,可能比vb實際些
      

  5.   

    Private Declare Function SetPixel Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long) As LongOption ExplicitPrivate Const MaxExpRad = 50
    Private Const Gravity = 0.09Private Type Color
        R As Integer
        G As Integer
        B As Integer
        Rpace As Integer
        Gpace As Integer
        Bpace As Integer
    End TypePrivate Type Firework
        EX(MaxExpRad) As Single
        EY(MaxExpRad) As Single
        OldEx(MaxExpRad) As Single
        OldEy(MaxExpRad) As Single
        EXD(MaxExpRad) As Single
        EYD(MaxExpRad) As Single
        Col As Color
        x As Integer
        y As Integer
    End TypeDim MyFW(1 To 10) As FireworkPrivate Sub Command1_Click()
        Randomize Timer
        Dim Num As Integer, n As Integer
        Dim i As Integer
        
        Picture1.Cls
        n = UBound(MyFW)
        For Num = 1 To n
            MyFW(Num).Col.R = Int(Rnd * 100) + 155
            MyFW(Num).Col.Rpace = Int(Rnd * 3) + 3
            MyFW(Num).Col.G = Int(Rnd * 100) + 155
            MyFW(Num).Col.Gpace = Int(Rnd * 3) + 3
            MyFW(Num).Col.B = Int(Rnd * 100) + 155
            MyFW(Num).Col.Bpace = Int(Rnd * 3) + 3
            MyFW(Num).x = Int(Rnd * Picture1.ScaleWidth) + 1
            MyFW(Num).y = Int(Rnd * Picture1.ScaleHeight) + 1
            For i = 1 To MaxExpRad
                MyFW(Num).EX(i) = MyFW(Num).x
                MyFW(Num).EY(i) = MyFW(Num).y
                MyFW(Num).EXD(i) = Rnd - Rnd
                MyFW(Num).EYD(i) = Rnd - Rnd
            Next i
        Next Num
        
        Do
            For Num = 1 To n
                For i = 1 To MaxExpRad
                    MyFW(Num).OldEx(i) = MyFW(Num).EX(i)
                    MyFW(Num).OldEy(i) = MyFW(Num).EY(i)
                    SetPixel Picture1.hdc, MyFW(Num).OldEx(i), MyFW(Num).OldEy(i), vbBlack
                    MyFW(Num).EX(i) = MyFW(Num).EX(i) + MyFW(Num).EXD(i)
                    MyFW(Num).EY(i) = MyFW(Num).EY(i) + MyFW(Num).EYD(i)
                    MyFW(Num).EYD(i) = MyFW(Num).EYD(i) + Gravity * Rnd
                    SetPixel Picture1.hdc, MyFW(Num).EX(i), MyFW(Num).EY(i), RGB(MyFW(Num).Col.R, MyFW(Num).Col.G, MyFW(Num).Col.B)
                    DoEvents
                Next i
                MyFW(Num).Col.R = MyFW(Num).Col.R - MyFW(Num).Col.Rpace
                MyFW(Num).Col.G = MyFW(Num).Col.G - MyFW(Num).Col.Gpace
                MyFW(Num).Col.B = MyFW(Num).Col.B - MyFW(Num).Col.Bpace
                If MyFW(Num).Col.R < 0 Then MyFW(Num).Col.R = 0
                If MyFW(Num).Col.G < 0 Then MyFW(Num).Col.G = 0
                If MyFW(Num).Col.B < 0 Then MyFW(Num).Col.B = 0
                If RGB(MyFW(Num).Col.R, MyFW(Num).Col.G, MyFW(Num).Col.B) = 0 Then
                    MyFW(Num).Col.R = Int(Rnd * 100) + 155
                    MyFW(Num).Col.Rpace = Int(Rnd * 4) + 3
                    MyFW(Num).Col.G = Int(Rnd * 100) + 155
                    MyFW(Num).Col.Gpace = Int(Rnd * 4) + 3
                    MyFW(Num).Col.B = Int(Rnd * 100) + 155
                    MyFW(Num).Col.Bpace = Int(Rnd * 4) + 3
                    MyFW(Num).x = Int(Rnd * Picture1.ScaleWidth) + 1
                    MyFW(Num).y = Int(Rnd * Picture1.ScaleHeight) + 1
                    For i = 1 To MaxExpRad
                        MyFW(Num).EX(i) = MyFW(Num).x
                        MyFW(Num).EY(i) = MyFW(Num).y
                        MyFW(Num).EXD(i) = Rnd - Rnd
                        MyFW(Num).EYD(i) = Rnd - Rnd
                    Next i
                End If
            Next Num
        Loop
    End SubPrivate Sub Form_Unload(Cancel As Integer)
        Unload Me
        End
    End Sub