求vb输入长宽就可画出空心矩形的代码?
1个回答
展开全部
你用VS2005,选File -> New -> Project
找Visual Basic -> Windows -> Windows Application
在灰色的窗体上双击。
用这些代码替换全部代码
Public Class Form1
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As Public Class Form1
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
' 这个是颜色
Dim skyBluePen As New Pen(Brushes.DeepSkyBlue)
Dim returnValue As Graphics
returnValue = CreateGraphics()
' 这里是要画的东西,10,10是左上,50,50是宽度和高度
returnValue.DrawRectangle(skyBluePen, 10, 10, 50, 50)
End Sub
End Class
找Visual Basic -> Windows -> Windows Application
在灰色的窗体上双击。
用这些代码替换全部代码
Public Class Form1
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As Public Class Form1
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
' 这个是颜色
Dim skyBluePen As New Pen(Brushes.DeepSkyBlue)
Dim returnValue As Graphics
returnValue = CreateGraphics()
' 这里是要画的东西,10,10是左上,50,50是宽度和高度
returnValue.DrawRectangle(skyBluePen, 10, 10, 50, 50)
End Sub
End Class
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询