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
分享名稱:vb.net畫長方體 vb長方形面積代碼
本文來源:http://www.yijiale78.com/article20/dodcdco.html
成都網站建設公司_創新互聯,為您提供企業建站、網站營銷、ChatGPT、網站維護、品牌網站設計、網頁設計公司
聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯