vb.net曲线 vbnet曲线

vb.net连续绘制曲线图不消失

您好,您是想问vb.net连续绘制曲线图不消失怎么办?b.net连续绘制曲线图不消失的解决办法如下:

创新互联凭借专业的设计团队扎实的技术支持、优质高效的服务意识和丰厚的资源优势,提供专业的网站策划、成都网站建设、网站建设、网站优化、软件开发、网站改版等服务,在成都10年的网站建设设计经验,为成都成百上千中小型企业策划设计了网站。

1、首先必须创建bitmap,关联到picturebox1.image上。

2、再在picturebox1.image上创建Graphics,再进行作图。即可显示线图。

VB.NETsin曲线

Dim Points1(30) As Point

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

Timer1.Enabled = True

Timer1.Interval = 200

For i = 0 To 30

Points1(i) = New Point(i * 45, Math.Sin(i) * (PictureBox1.Height - 50) / 9)

Points1(i).Offset(-450, Math.Abs(Points1(i).Y - (PictureBox1.Height - 50) / 9) * 3.55 + 43)

Next

End Sub

Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick

Static j As Long

j = j + 1

PictureBox1.Image = x_y(PictureBox1, j)

End Sub

Private Function x_y(ByVal pic As PictureBox, ByVal x As Long) As Bitmap

Dim b As New Bitmap(pic.Width, pic.Height)

Dim g As Graphics = Graphics.FromImage(b)

Dim c

Dim j

g.Clear(Color.YellowGreen)

Dim p As New Pen(Color.WhiteSmoke)

p.EndCap = Drawing2D.LineCap.ArrowAnchor

g.DrawLine(p, 20, pic.Height - 20, 20, 10)

g.DrawLine(p, 20, pic.Height - 20, pic.Width - 20, pic.Height - 20)

Dim i As Double

Dim bs As New SolidBrush(Color.Red)

Dim po As New Point

g.DrawString(-2, Me.Font, bs, 12, pic.Height - 18)

po.X = 0

po.Y = pic.Height - 45

For i = -1.6 To 4 Step 0.4

g.DrawString(Math.Round(i, 1), Me.Font, bs, po.X, po.Y)

g.DrawLine(p, po.X + 18, po.Y + 5, po.X + 20, po.Y + 5)

Dim p1 As New Pen(Color.Blue)

p1.DashStyle = Drawing2D.DashStyle.Dash

g.DrawLine(p1, po.X + 28, po.Y + 5, pic.Width - 20, po.Y + 5)

po.Y -= (pic.Height - 50) / 9

Next

po.X = 20

po.Y = pic.Height - 20

For c = 0 To 14400 Step 1200

If (c / 1200) 0 Then

g.DrawString((c / 1200) + x, Me.Font, bs, po.X - j, po.Y + 5)

End If

g.DrawLine(p, po.X, po.Y + 2, po.X, po.Y)

po.X += (pic.Width - 50) / 12

Next

For i = 0 To Points1.Count - 1

Points1(i).Offset(45, 0)

Next

If x Mod 6 = 0 Then

For i = 0 To Points1.Count - 1

Points1(i).Offset(-270, 0)

Next

End If

g.DrawCurve(Pens.Red, Points1)

'For i = 0 To Points1.Count - 1

'g.DrawString(Math.Sin(i), Me.Font, Brushes.Red, Points1(i))

'Next

Return b

End Function

vb.net绘制曲线图

。net  其实还是很好绘制图形的

你可以看下 Graphics  类

Dim d As New Bitmap(Me.Width, Me.Height)  ‘一个图片吧

  Dim g As Graphics = Graphics.FromImage(d)’绘制  准备在这个图片是进行

然后  就是你绘制的东西了

线 就是   g.DrawLine()

圆 弧度  就用  g.DrawArc(Pens.Black, New Rectangle(0, 0, 400, 200), 0, 360)

复杂的就是      g.DrawBezier()

等  如果你用的是 VS的  编译  上面都有详细的参数说明

Dim d As New Bitmap(Me.Width, Me.Height)

Dim g As Graphics = Graphics.FromImage(d)

g.DrawArc(Pens.Black, New Rectangle(0, 0, 200, 200), 0, 360)

g.DrawLine(Pens.Red, New Point(0, 0), New Point(200, 200))

g.DrawLines(Pens.Green, New Point() {New Point(0, 0), New Point(50, 40), New Point(50, 80), New Point(90, 70), New Point(100, 400)})

g.DrawBezier(Pens.Yellow, New Point(0, 100), New Point(0, 0), New Point(200, 0), New Point(200, 200))

g.Dispose()

Me.BackgroundImage = d

VB.NET 实时曲线

拖一个PictureBox1控件 创建一个Paint事件。在事件中加入 Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint ' Create pens. Dim redPen As New Pen(Color.Red, 3) Dim greenPen As New Pen(Color.Green, 3) ' Create points that define curve. Dim point1 As New Point(50, 50) Dim point2 As New Point(100, 25) Dim point3 As New Point(200, 5) Dim point4 As New Point(250, 50) Dim point5 As New Point(300, 100) Dim point6 As New Point(350, 200) Dim point7 As New Point(250, 250) Dim curvePoints As Point() = {point1, point2, point3, point4, _ point5, point6, point7} ' Draw lines between original points to screen. e.Graphics.DrawLines(redPen, curvePoints) ' Draw curve to screen. e.Graphics.DrawCurve(greenPen, curvePoints) End Sub 得到数据后,改point的数据。然后PictureBox1.Refresh()就行了


本文题目:vb.net曲线 vbnet曲线
标题链接:http://bzwzjz.com/article/dojechc.html

其他资讯

Copyright © 2007-2020 广东宝晨空调科技有限公司 All Rights Reserved 粤ICP备2022107769号
友情链接: 网站建设方案 成都企业网站制作 网站制作公司 网站制作 成都商城网站制作 响应式网站设计 成都网站建设 教育网站设计方案 企业网站制作 品牌网站建设 成都网站建设 营销网站建设 成都网站建设 定制网站建设多少钱 成都网站建设 达州网站设计 重庆网站设计 成都网站制作 成都网站制作公司 专业网站设计 成都网站建设 手机网站制作