请教一个vb题目
来源:百度知道 编辑:UC知道 时间:2024/06/24 09:48:05
这是我的编程,但是有错的,应该怎么改呢?
Private Sub Command1_Click()
Dim x As Integer
Picture1.Scale (-ScaleWidth / 2, ScaleHeight / 2)-(ScaleWidth / 2, -ScaleHeight / 2)
Picture1.FillStyle = 1
Picture1.FillColor = RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value)
Picture1.Circle (0, 0), ScaleHeight / 2, vbRed
Picture1.FillStyle = 1
FillColor = BackColor
Picture1.Circle (0, 0), ScaleHeight / 4, vbRed
End Sub
Private Sub Form_Load()
Label1.Caption = "红色"
Label2.Caption = "绿色"
Label3.Caption = "蓝色"
Command1.Caption = "画图"
End Sub
2个错误
1,fillstyle要用0,实心; 1是透明,画了没用.严重错误
2,form_load的时候设置好滚动条的最大最小值为0-255,否则不行
代码如下,把你的删除了,复制过去运行,ok
=======================
Private Sub Command1_Click()
Dim x As Integer
Picture1.Scale (-ScaleWidth / 2, ScaleHeight / 2)-(ScaleWidth / 2, -ScaleHeight / 2)
Picture1.FillStyle = 0
Picture1.FillColor = RGB(HScroll1.Value, HScroll2.Value, HScroll3.Value)
'Picture1.ForeColor = Picture1.FillColor
Picture1.Circle (0, 0), ScaleHeight / 2, vbRed
Picture1.FillStyle = 0
Picture1.FillColor = Picture1.BackColor
Picture1.Circle (0, 0), ScaleHeight / 4, vbRed
End Sub
Private Sub Form_Load()
Label1.Caption = "红色"
Label2.Caption = "绿色"
Label3.Caption = "蓝色"
Command1.Caption = "画图"
HScroll1.Min = 0: HScroll1.Max = 255
HScroll2.Min = 0: HScroll2.Max = 255
HScroll3.Min = 0: HScroll3.Max = 255
End Sub
就这样看没错啊