dim a as single=...'自己輸入長(zhǎng)方形的長(zhǎng)
創(chuàng)新互聯(lián)主營(yíng)堆龍德慶網(wǎng)站建設(shè)的網(wǎng)絡(luò)公司,主營(yíng)網(wǎng)站建設(shè)方案,app軟件定制開(kāi)發(fā),堆龍德慶h5微信小程序搭建,堆龍德慶網(wǎng)站營(yíng)銷(xiāo)推廣歡迎堆龍德慶等地區(qū)企業(yè)咨詢(xún)
dim b as single=...'自己輸入長(zhǎng)方形的寬
dim c as single=a*b'計(jì)算面積
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]這個(gè)在注釋語(yǔ)句里我也不清楚要怎么填,不會(huì)是題目搞錯(cuò)了吧。-_-|||
[7] return 2 *( rectWidth+ rectHeight)
[8] return rectWidth * rectHeight
[9] ,[10] 應(yīng)該是對(duì)rectl的width 和height 屬性賦值。
messagebox。show(“長(zhǎng)方形rect1的周長(zhǎng)是:” rectl.GetSize “長(zhǎng)方形rect2的面積是:” rectl.GetArea)
這在其他語(yǔ)言中很好辦(尤其是C++),在VB中就不太好辦了,你嘗試著用一下OpenGL,網(wǎng)上有資料
VB.net與VB不同。
VB.net已經(jīng)有專(zhuān)門(mén)繪圖的類(lèi)。
可以定義筆刷然后用Drawing類(lèi)中的方法繪制。
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
分享名稱(chēng):vb.net畫(huà)長(zhǎng)方體 vb長(zhǎng)方形面積代碼
本文來(lái)源:http://chinadenli.net/article20/dodcdco.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供企業(yè)建站、網(wǎng)站營(yíng)銷(xiāo)、ChatGPT、網(wǎng)站維護(hù)、品牌網(wǎng)站設(shè)計(jì)、網(wǎng)頁(yè)設(shè)計(jì)公司
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容