分类: 电脑/网络 程序设计 其他编程语言
东兴网站制作公司哪家好,找成都创新互联!从网页设计、网站建设、微信开发、APP开发、响应式网站建设等网站项目制作,到程序开发,运营维护。成都创新互联2013年开创至今到现在10年的时间,我们拥有了丰富的建站经验和运维经验,来保证我们的工作的顺利进行。专注于网站建设就选成都创新互联。
问题描述:
VB6中的form1.circle (100,200),rgb(0,255,0)的语句如何在VB中使用啊?
急用啊!!!!!!!!
解析:
VB与VB不同。
VB已经有专门绘图的类。
可以定义笔刷然后用Drawing类中的方法绘制。
Private Sub DrawEllipse()
Dim myPen As New System.Drawing.Pen(System.Drawing.Color.Red)
Dim formGraphics as System.Drawing.Graphics
formGraphics = Me.CreateGraphics()
formGraphics.DrawEllipse(myPen, New Rectangle(0,0,200,300))
myPen.Dispose()
formGraphics.Dispose()
End Sub
Private Sub DrawRectangle()
Dim myPen As New System.Drawing.Pen(System.Drawing.Color.Red)
Dim formGraphics as System.Drawing.Graphics
formGraphics = Me.CreateGraphics()
formGraphics.DrawRectangle(myPen, New Rectangle(0,0,200,300))
myPen.Dispose()
formGraphics.Dispose()
End Sub
写程序不就行了,左边触发单击事件,然后执行相应的程序块之右边的内容变动就行了。
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim aa As Integer = Val(TextBox1.Text)
Dim i As Integer
For i = 2 To aa
If aa Mod i = 0 Then
TextBox2.Text += i.ToString + " "
aa = aa / i
i = 2
End If
Next
End Sub
Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextBox1.Text = ss()
TextBox2.Text = ss()
End Sub
Function ss()
Randomize()
Dim a As Integer = Int(Rnd() * 100)
Return a
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Val(TextBox1.Text) + Val(TextBox2.Text) = Val(TextBox3.Text) Then
i += 1
Label3.Text = "正确"
Else
j += 1
Label3.Text = "错误"
End If
aa += 1
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox1.Text = ss()
TextBox2.Text = ss()
TextBox3.Text = ""
Label3.Text = ""
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
TextBox4.Text = "你已经答了" + aa.ToString + "题,答对" + i.ToString + "题," + "答错" + j.ToString + "题。"
End Sub