快上网专注成都网站设计 成都网站制作 成都网站建设
成都网站建设公司服务热线:028-86922220

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

vb.net绘制曲线图 vb怎么根据数据绘制曲线

请问怎么样用VB.net(C#)在Excel上绘制曲线图?

Beginning VB 2008 从入门到精通 ;ID=181830 Pro VB 2008 and the .NET 3.5 Platform ;ID=184746 Visual Basic 2008 Programmerss Reference ;ID=181605 Apress Accelerated VB 2008 ;ID=181504 Visual Basic 2008 Step by Step Wrox Professional VB 2005 with .NET 3.0 ;ID=158893 Build A Program Now Visual Basic 2005 ;ID=146029 .NET游戏编程入门经典—VB.NET篇 ;ID=158821 O'Reilly Visual Basic 2005 Cookbook ;ID=160654 .NET Insight for Classic VB Developers ;ID=162041 Fast Track Visual Basic.NET ;ID=161990 Security for Microsoft Visual Basic.NET ;ID=175012 Visual Basic.NET How to Program 第二版 ;ID=173182 Visual Basic 2005 简明教程 ;ID=173180 Visual Basic 2005傻瓜书 ;ID=173178 Programming Visual Basic.NET ;ID=173164 Visual Basic .NET Tips and Techniques ;ID=176561 VB开发人员SQL Sever指南 ;ID=173176 How to Code .NET ;ID=145559 Essential .NET, Volume I ;ID=176152 ADO.NET全攻略 . 查看原帖

创新互联建站是少有的成都网站设计、成都做网站、营销型企业网站、小程序开发、手机APP,开发、制作、设计、友情链接、推广优化一站式服务网络公司,自2013年起,坚持透明化,价格低,无套路经营理念。让网页惊喜每一位访客多年来深受用户好评

大佬们~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, 200 + Sin(i) * Zong)

  Next

  '采用绘制光滑线连接点的方式绘制曲线

  MyGraphics.DrawCurve(MyPen, MyPoints)

End Sub

End Class

显示的效果图:

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中如何使用mschart 控件画曲线图

具体操作步骤如下:

1、首先,单击左侧工具框中的命令按钮,如下图所示,然后进入下一步。

     

2、其次,双击以直接在表单上绘制,如下图所示,然后进入下一步。

   

3、接着,或者可以单击命令按钮控件,再在页面上拖动绘制,如下图所示,然后进入下一步。

     

4、然后,如果对外观不满意,可以在属性窗口中对其进行更改,如下图所示,然后进入下一步。

     

5、随后,可以直接进入代码窗口,如下图所示,然后进入下一步。

     

6、最后,编写号后,单击运行即可,如下图所示。这样,问题就解决了。

     


本文标题:vb.net绘制曲线图 vb怎么根据数据绘制曲线
转载来于:http://6mz.cn/article/hjdscd.html

其他资讯