
正文
用VB.net画一个梯形,c语言画梯形
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
VB.net中如何画图?
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
相关问答
Q1: 用vb语言编写一个计算梯形面积的程序
#include void main() { float a, b, h; // 梯形的上底、下底和高 printf("请依次输入梯形的上底、下底和高:"); scanf("%f%f%f", a, b,h); printf("梯形的面积:%f", (a+b)*h/2); }
Q2: vb程序代码中的梯形公式怎么编写
's=(上底+下底)×高÷2
private
sub
form_load()
me.show
a
=
val(inputbox("请输入梯形上底"))
b
=
val(inputbox("请输入梯形下底"))
h
=
val(inputbox("请输入梯形的高"))
"梯形上底=";
a
"梯形下底=";
b
"梯形高=";
h
"梯形面积=";
(a
+
b)
*
h
/
2
end
sub
Q3: 求用vb ,用双重循环,打印一个等腰梯形,等腰三角形和正方形图案,用“*”打印,谢谢!
Private Sub Command1_Click() '等腰三角形
Dim i As Integer, n As Integer
n = 5
For i = 1 To n
Print Space(n - i); String(2 * i - 1, "*")
Next
End Sub
Private Sub Command2_Click() '正方形
Dim i As Integer, n As Integer
n = 5
For i = 1 To n
For j = 1 To n
Print "* ";
Next
Next
End Sub
Private Sub Command3_Click() '等腰梯形
Dim i As Integer, n As Integer, m As Integer
n = 5
m = 5
For i = 1 To n
Print Space(n - i); String(2 * i - 1 + m, "*")
Next
End Sub
Q4: vb.net画一个矩形图片的代码
g = Me.picDisplay.CreateGraphics
Dim mybrush As Brush = New SolidBrush(Map_Empty_Color)
Dim rect2 As System.Drawing.Rectangle = New System.Drawing.Rectangle(0, 0, Map_Width, Map_Height)
g.FillRectangle(mybrush, rect2)








