各位大哥大姐帮个忙 看下我的程序 运行时是不是出错

解决方案 »

  1.   

    不好意思啊,新手还不太懂提问的方法,程序运行时会出错并提示:无效属性值 drawwidth值
    下面是代码 Public xe, ye
    Private Sub Command1_Click()
    Timer1.Enabled = True
    End SubPrivate Sub Command2_Click()
        Timer2.Enabled = False '够了
        Timer1.Enabled = False
        Timer3.Enabled = False
       
    End SubPrivate Sub Command3_Click()
    End
    End SubPrivate Sub Form_Resize()
    Refresh
    End SubPrivate Sub Timer1_Timer()
    Static k '彩色园斑与祝福
    k = k + 1
    FontSize = 44
    FontItalic = True
    x0 = ScaleWidth / 5
    y0 = ScaleHeight / 3.6
    Randomize
    ForeColor = RGB(255 * Rnd, 255 * Rnd, 255 * Rnd)
     PSet (x0, y0): Print "XX,生日快乐!"
     If k > 8 Then PSet (x0 + 130, y0 + 1050): Randomize: ForeColor = RGB(255 * Rnd, 255 * Rnd, 255 * Rnd): Print "冬已至,记得加衣!"
     If k > 17 Then PSet (x0 + 560, y0 + 2150): Randomize: ForeColor = RGB(255 * Rnd, 255 * Rnd, 255 * Rnd): Print "Go Go加油!"
    Randomize
    t = Fix(50 * Rnd)
    DrawWidth = tRandomize
    x = Round(ScaleWidth * Rnd / 1.01, 3)
    Randomize
    y = Round(ScaleHeight * Rnd / 1.01, 3)
    Randomize
    pset (x, y),  RGB(255 * Rnd, 255 * Rnd, 255 * Rnd)End SubPrivate Sub Timer2_Timer()
    Static x, y, j, k '阿基米德螺线
        k = k + 1
        DrawWidth = 3
        a = 5
        f = 0.09
        j = j + f
        x = x + a * Cos(j) - a * j * Sin(j)
        y = y + a * Sin(j) + a * j * Cos(j)
        PSet (x + ScaleWidth / 2.5, y + ScaleHeight / 2.1), vbBlue
      If k > 460 Then Timer2.Enabled = False: Timer3.Enabled = True
        
        
        
    End SubPrivate Sub Timer3_Timer()
    Static x1, y1, j, k '三叶玫瑰
        DrawWidth = 3
        a = 10
        f = 0.005
        k = k + 1
        j = j + f
        x1 = x1 + a * (3 * Cos(3 * j) * Cos(j) - Sin(j) * Sin(3 * j))
        y1 = y1 + a * (3 * Cos(3 * j) * Sin(j) + Cos(j) * Sin(3 * j))
        PSet (x1 + ScaleWidth / 2.5, y1 + ScaleHeight / 2.1), QBColor(8)
     
       
        If k Mod 25 = 0 Then
        xe = CurrentX: ye = CurrentY
        PSet (xe, ye)
        FontSize = 10: Print "happy"
        End If
        If k > 650 Then Timer3.Enabled = False
            
        End Sub
      

  2.   

    不好意思啊,新手还不太懂提问的方法,程序运行时会出错并提示:无效属性值 drawwidth值
    下面是代码 Public xe, ye
    Private Sub Command1_Click()
    Timer1.Enabled = True
    End SubPrivate Sub Command2_Click()
        Timer2.Enabled = False '够了
        Timer1.Enabled = False
        Timer3.Enabled = False
       
    End SubPrivate Sub Command3_Click()
    End
    End SubPrivate Sub Form_Resize()
    Refresh
    End SubPrivate Sub Timer1_Timer()
    Static k '彩色园斑与祝福
    k = k + 1
    FontSize = 44
    FontItalic = True
    x0 = ScaleWidth / 5
    y0 = ScaleHeight / 3.6
    Randomize
    ForeColor = RGB(255 * Rnd, 255 * Rnd, 255 * Rnd)
     PSet (x0, y0): Print "XX,生日快乐!"
     If k > 8 Then PSet (x0 + 130, y0 + 1050): Randomize: ForeColor = RGB(255 * Rnd, 255 * Rnd, 255 * Rnd): Print "冬已至,记得加衣!"
     If k > 17 Then PSet (x0 + 560, y0 + 2150): Randomize: ForeColor = RGB(255 * Rnd, 255 * Rnd, 255 * Rnd): Print "Go Go加油!"
    Randomize
    t = Fix(50 * Rnd)
    DrawWidth = tRandomize
    x = Round(ScaleWidth * Rnd / 1.01, 3)
    Randomize
    y = Round(ScaleHeight * Rnd / 1.01, 3)
    Randomize
    pset (x, y),  RGB(255 * Rnd, 255 * Rnd, 255 * Rnd)End SubPrivate Sub Timer2_Timer()
    Static x, y, j, k '阿基米德螺线
        k = k + 1
        DrawWidth = 3
        a = 5
        f = 0.09
        j = j + f
        x = x + a * Cos(j) - a * j * Sin(j)
        y = y + a * Sin(j) + a * j * Cos(j)
        PSet (x + ScaleWidth / 2.5, y + ScaleHeight / 2.1), vbBlue
      If k > 460 Then Timer2.Enabled = False: Timer3.Enabled = True
        
        
        
    End SubPrivate Sub Timer3_Timer()
    Static x1, y1, j, k '三叶玫瑰
        DrawWidth = 3
        a = 10
        f = 0.005
        k = k + 1
        j = j + f
        x1 = x1 + a * (3 * Cos(3 * j) * Cos(j) - Sin(j) * Sin(3 * j))
        y1 = y1 + a * (3 * Cos(3 * j) * Sin(j) + Cos(j) * Sin(3 * j))
        PSet (x1 + ScaleWidth / 2.5, y1 + ScaleHeight / 2.1), QBColor(8)
     
       
        If k Mod 25 = 0 Then
        xe = CurrentX: ye = CurrentY
        PSet (xe, ye)
        FontSize = 10: Print "happy"
        End If
        If k > 650 Then Timer3.Enabled = False
            
        End Sub
      

  3.   

    drawwidth用于返回或设置图形方法输出的线宽其值为1 到 32,767,而你的程序中
    t = Fix(50 * Rnd) 
    DrawWidth = t 
    当t=0时就会出现drawwidth属性值无效的错误.建议将t = Fix(50 * Rnd)改为t = Fix(50 * Rnd)+1