vb.net数据绘图 vb画图

VB.net中如何画图?分类:电脑/网络程序设计其他编程语言
问题描述:
VB6中的form1.circle (100,200),rgb(0,255,0)的语句如何在VB中使用?。?
急用?。。。。。。。。?
解析:
VB与VB不同 。
VB已经有专门绘图的类 。
可以定义笔刷然后用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
vb.net读取txt的数据作图问题一、分析:
1,这一类随时间而变化的曲线图 , 通常把横轴作为时间,把纵轴作为相应的值 , 在这里就是密度值 。
2 , 点的集合就是线;一组时间、密度值,对应一个点,把点连接起来就构成了线 。
二、在VB.NET中作图,需要知道并解决几个问题:
1,与VB6一样 , VB.NET中默认的坐标系统,左上角为坐标原点,X轴的正向为从左向右 , Y轴的正向是从上向下 。
为了使得它与数学中的坐标系统相一致,可以使用VB.NET中Graphics类的两个方法;
1、TranslateTransform----平移变换
格式:Graphics.TranslateTransform(dx,dy)
其中:dx 和 dy分别是Single数据类型
2、ScaleTransform----缩放变换
格式:Graphics.ScaleTransform(sx,sy)
其中:sx 和 sy分别是Single数据类型;
例如:为了符合数学中的一般格式,可以使用下述代码:
Graphics.ScaleTransform(1, -1)
这样就把Y轴的正方向给翻过来了 。
三、VB.NET中绘制图形
1 , 绘制圆或椭圆
'绘制图形的三步曲
'1,获得一个Graphics对象
Dim MyGraphics As Graphics
MyGraphics = Me.CreateGraphics
'2,定义一个Pen对象,用于绘制图形(轮廓线)
Dim MyPen As New Pen(Color.Black)
'3,定义一个Brush对象 , 用于填充图形(如果需要填充的话)
Dim MyBrush As New SolidBrush(Color.Orange)
'绘制一个实心圆,该圆在:直线x=200,y=200 , x=200+100,y=200+100所划的矩形区域内
MyGraphics.FillEllipse(Brush, 200, 200, 100, 100)
'绘制一个空心圆,该圆在:直线x=200,y=200,x=200+100,y=200+100所划的矩形区域内
MyGraphics.DrawEllipse(Pen, 200, 200, 100, 100)
注意:最后两个数值如果不等,就是绘制椭圆
当圆足够小,就是点了 。
2 , 绘制直线
'1,获得一个Graphics对象
Dim MyGraphics As Graphics
MyGraphics = Me.CreateGraphics
'2,定义一个Pen对象,用于绘制图形(轮廓线)
Dim MyPen As New Pen(Color.Black)
MyGraphics.DrawLine(MyPen, 200, 200, 100, 100)
'或者直接用
Me.CreateGraphics.DrawLine(New Pen(Color.Black), 50, 50, 200, 200)
vb.net绘制曲线图 。net其实还是很好绘制图形vb.net数据绘图的
vb.net数据绘图你可以看下 Graphics类
Dim d As New Bitmap(Me.Width, Me.Height)‘一个图片吧
Dim g As Graphics = Graphics.FromImage(d)’绘制准备在这个图片是进行
然后就是你绘制vb.net数据绘图的东西了
线 就是g.DrawLine()
圆 弧度就用g.DrawArc(Pens.Black, New Rectangle(0, 0, 400, 200), 0, 360)
复杂vb.net数据绘图的就是g.DrawBezier()

推荐阅读