扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
dim a as single=...'自己输入长方形的长
创新互联主营堆龙德庆网站建设的网络公司,主营网站建设方案,app软件定制开发,堆龙德庆h5微信小程序搭建,堆龙德庆网站营销推广欢迎堆龙德庆等地区企业咨询
dim b as single=...'自己输入长方形的宽
dim c as single=a*b'计算面积
textbox1.text=c'显示面积
Private Sub Command1_Click()
Const π = 3.14159127
For i = 0 To 9
For j = 0 To 360 Step 30
Me.Circle (Sin(j * (π / 180)) * 150 + 800 * i + 500, Cos(-j * (π / 180)) * 150 + 500), 100, vbRed
Next
Next
End Sub
Private Sub Command2_Click()
For i = 0 To 9
Line (i * 800 + 250, 1000)-(i * 800 + 750, 1500), vbMagenta, B
Next
End Sub
Private Sub Command3_Click()
For i = 0 To 9
Line (i * 800 + 250, 1700)-(i * 800 + 750, 1900), vbBlue, B
Next
End Sub
Private Sub Command4_Click()
Cls
End Sub
Private Sub Form_Load()
Move 0, 0, 9675, 4300
Me.AutoRedraw = True
Command1.Move 8160, 480, 1215, 495
Command2.Move 8160, 1080, 1215, 495
Command3.Move 8160, 1680, 1215, 495
Command4.Move 8160, 2280, 1215, 495
End Sub
[1] private rectWidth As double ,rectHeight As double
[2] return rectWidth
[3] rectWidth=value
[4] return rectHeight
[5] rectHeight=value
[6]这个在注释语句里我也不清楚要怎么填,不会是题目搞错了吧。-_-|||
[7] return 2 *( rectWidth+ rectHeight)
[8] return rectWidth * rectHeight
[9] ,[10] 应该是对rectl的width 和height 属性赋值。
messagebox。show(“长方形rect1的周长是:” rectl.GetSize “长方形rect2的面积是:” rectl.GetArea)
这在其他语言中很好办(尤其是C++),在VB中就不太好办了,你尝试着用一下OpenGL,网上有资料
VB.net与VB不同。
VB.net已经有专门绘图的类。
可以定义笔刷然后用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
Option Explicit
Dim W As Integer
Dim L As Integer
Dim H As Integer
Dim x As Integer
Dim i As Integer
Dim y As Integer
Dim pi As Single
Private Sub Command1_Click()
pi = 3.141592654
W = 5000
L = 3000
H = 1000
x = 200
y = 5000
Line (x, y)-(x + L, y + H), vbBlue, BF
For i = 1 To H
Line (x + L, y + i)-(x + L + W * (Sin(pi / 4)), y + i - W * (Sin(pi / 4))), vbRed
Next
For i = 1 To L
Line (x + i, y)-(x + i + W * (Sin(pi / 4)), y - W * (Sin(pi / 4))), vbYellow
Next
End Sub
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流