vb.net饼图 饼图用于显示什么数据
用vb.net可以做出饼图吗
Dim MyGraphics As Graphics = Me.PictureBox1.CreateGraphics
创新互联服务项目包括丽水网站建设、丽水网站制作、丽水网页制作以及丽水网络营销策划等。多年来,我们专注于互联网行业,利用自身积累的技术优势、行业经验、深度合作伙伴关系等,向广大中小型企业、政府机构等提供互联网行业的解决方案,丽水网站推广取得了明显的社会效益与经济效益。目前,我们服务的客户以成都为中心已经辐射到丽水省份的部分城市,未来相信会继续扩大服务区域并继续获得客户的支持与信任!
Dim MyBrush As New SolidBrush(Color.Red)
Dim MyProportion As Single
Dim MyRect As New Rectangle
Dim MyPoint As New PointF
Dim R As Single
Const PI = 3.1415926
MyGraphics.Clear(Color.White)
Dim MyStartAngel As Double
Dim MySweepAngel As Double
R = Math.Min(Me.PictureBox1.Width, Me.PictureBox1.Height) / 2 - 15
MyPoint.X = Me.PictureBox1.Width / 2
MyPoint.Y = Me.PictureBox1.Height / 2
MyRect.X = MyPoint.X - R
MyRect.Y = MyPoint.Y - R
MyRect.Width = R * 2
MyRect.Height = R * 2
MyStartAngel = 0
MyProportion = Val(TextBox7.Text)
MySweepAngel = MyProportion * 360 / PI
MyBrush.Color = Color.Red
MyGraphics.FillPie(MyBrush, MyRect, MyStartAngel, MySweepAngel)
' MyStartAngel = MyStartAngel + MySweepAngel
MyProportion = 0.75
MySweepAngel = 360 * MyProportion
MyBrush.Color = Color.Blue
MyGraphics.FillPie(MyBrush, MyRect, MyStartAngel, MySweepAngel)
我想问下,讲数据保存到excel中后,如何在VB.net中继续写代码,使得能够将这些数据生成一个饼图?并保存。
用宏功能啊,然后把宏代码(vb6.0)转化为Vb.net代码,有一个关键问题,就是VBA中的枚举类型在Vb.net中不适用,比如.End(xlUp)更改为.End(3)就能运行,另外vb.net中运行Excel对象不一定在点后会出现智能提示(即使你引用后也一样)你只要确定有该方法或者属性,直接写就是了,生成或者调试都是可以通过的
VB.Net如何实现抠图并绘图
项目中要用图形来显示一个阀门的开度,以及控制阀的开度。本来是要用什么公司买的控件中的饼图之类的实现,不过我觉得也是麻烦,就想,还是自己画吧。
首先添加一个TrackBar,名字是“TrackBar1”,一个label,名字是“L_A_SHANG”,一个GroupBox,名字是“GB_RIGHT”,,然后添加拉动滚动条时的处理函数
'上位机控制
Dim m_start As Integer
Dim RcDraw As System.Drawing.Rectangle
Private Sub TrackBar1_Scroll(ByVal sender As Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll
m_start = (100 - TrackBar1.Value)
Me.L_A_SHANG.Text = Me.TrackBar1.Value.ToString
GB_RIGHT.Invalidate() '重画GB_RIGHT
End Sub
添加GB_RIGHT重画时的处理函数
Private Sub GB_RIGHT_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles GB_RIGHT.Paint
RcDraw.X = TrackBar1.Location.X - 40
RcDraw.Y = 20
RcDraw.Height = 100
RcDraw.Width = 20
e.Graphics.DrawRectangle(New Pen(Color.Blue, 5), RcDraw)
Dim i = TrackBar1.Location.X - 40
For i = TrackBar1.Location.X - 40 To TrackBar1.Location.X - 20
e.Graphics.DrawLine(New Pen(Color.Blue, 5), i, m_start + 20, i, 120)
Next
Me.L_A_SHANG.Text = Me.TrackBar1.Value.ToString + "%"
End Sub
到此以及可以实现拉动条的时候,图像跟着变化,并显示百分比。
vb.net中怎样曲线图,棒图,和饼图
vb2010以后的版本就自带Chart控件了,比如
Chart1.Series(0).ChartType = DataVisualization.Charting.SeriesChartType.Pie '饼图
当前文章:vb.net饼图 饼图用于显示什么数据
文章转载:http://ybzwz.com/article/dojioeg.html