大佬们~VisualStudio中vb.net如何画三角函数图像?VB系统的坐标原点在左上角,X轴的正方向是水平向右,而Y轴的正方向是垂直向下 。所以,要绘制三角函数的曲线,自己可以通过改变点坐标的方法来实现,当然,VB.NET提供了相应的方法可以来实现坐标变换 , 也可以通过VB.Net的Graphics类提供的平移、旋转等转换来实现 。
下面是我通过自己变换实现的示例,提供参考;我的环境是VB.NET 2010
Imports System.Math
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'1,获得一个Graphics对象
Dim MyGraphics As Graphics
MyGraphics = PictureBox1.CreateGraphics
'2,定义一个Pen对象,用于绘制图形(轮廓线)
Dim MyPen As New Pen(Color.Black, 1)
'3 , 定义一个Brush对象,用于填充图形(如果需要填充的话)
Dim MyBrush As New SolidBrush(Color.Orange)
MyGraphics.DrawLine(MyPen, 0, 200, 700, 200)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'1,获得一个Graphics对象
Dim MyGraphics As Graphics
MyGraphics = PictureBox1.CreateGraphics
'2,定义一个Pen对象,用于绘制图形(轮廓线)
Dim MyPen As New Pen(Color.Black, 1)
'3,定义一个Brush对象,用于填充图形(如果需要填充的话)
Dim MyBrush As New SolidBrush(Color.Orange)
'声明横向和纵向比例变量
Dim Heng As Integer = 20
Dim Zong As Integer = 50
'先获得正弦值,保存到点坐标数组
Dim MyPoints(700) As Point
Dim i As Integer
For i = 0 To 700
MyPoints(i) = New Point(i * Heng, 200Sin(i) * Zong)
Next
'采用绘制光滑线连接点的方式绘制曲线
MyGraphics.DrawCurve(MyPen, MyPoints)
End Sub
End Class
显示的效果图:
VB上怎么画三角形定义好三角形的三个点,用line画线连接即可 。
示例如下:
Private Sub Form_Load()
Me.AutoRedraw = True
Dim x As Integer
Dim y As Integer
CurrentX = 1500
CurrentY = 500
Line -(3000, 2000), RGB(0, 0, 255)
Line -(1500, 2000), RGB(0, 0, 255)
Line -(1500, 500), RGB(0, 0, 255)
End Sub
运行效果:
vb.net画图控件如何画三角网图形?Imports System.Drawing
Imports System.Drawing.Drawing2D
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim g As Graphics = PictureBox1.CreateGraphics
Dim hs As HatchStyle = HatchStyle.Cross
Dim sb As HatchBrush = New HatchBrush(hs, Color.Black, Color.White)
Dim p(3) As Point
p(0).X = 100
p(0).Y = 50
p(1).X = 0
p(1).Y = 100
p(2).X = 200
p(2).Y = 100
p(3).X = 100
p(3).Y = 50
g.FillPolygon(sb, p)
g.DrawPolygon(Pens.Black, p)
End Sub
End Class
vb画三角形Private Sub Form_Click()
Dim a, b, c, temp As Integer
a = Val(InputBox("a"))
temp = a
b = Val(InputBox("b"))
If ba Then
a = b
b = temp
End If
c = Val(InputBox("c"))
If ca Then
temp = a
a = c
c = temp
End If
If cb = a Then '判断是不是三角形
Print "不是三角形"
Exit Sub
End If
If a = b And b = c Then
Print "等边三角形"
ElseIf (a = b And bc) Or (a = c And ab) Then
Print "等腰三角形"
ElseIf ab And bc And ac Then
Print "一般三角形"
End If
End Sub
【包含vb.net画三角实例的词条】关于vb.net画三角实例和的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息 , 记得收藏关注本站 。
推荐阅读
- 老式电视手柄怎么连接,老式游戏手柄怎么连接电视
- 富文本flutter,富文本框
- 阿里服务器的购买,阿里云服务器购买指南
- 钉钉直播白屏,钉钉直播白屏了退出去时间
- go语言发展 go语言发展前景 知乎
- 餐饮店如何引流成本低,餐饮怎么样可以引流客源
- 山水美景单机游戏,山水美景单机游戏怎么玩
- 单机枪战游戏ios,单机枪战游戏单机版
- python中clf函数 python cls函数