189 8069 5689

vb.net制作饼形图 winform饼图

我想问下,讲数据保存到excel中后,如何在VB.net中继续写代码,使得能够将这些数据生成一个饼图?并保存。

用宏功能啊,然后把宏代码(vb6.0)转化为Vb.net代码,有一个关键问题,就是VBA中的枚举类型在Vb.net中不适用,比如.End(xlUp)更改为.End(3)就能运行,另外vb.net中运行Excel对象不一定在点后会出现智能提示(即使你引用后也一样)你只要确定有该方法或者属性,直接写就是了,生成或者调试都是可以通过的

创新互联公司2013年至今,是专业互联网技术服务公司,拥有项目成都做网站、网站建设网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元类乌齐做网站,已为上家服务,为类乌齐各地企业和个人服务,联系电话:028-86922220

谁能告诉我怎么在vb中从数据生成饼形图?

1. 建一个默认的project

2. 放一个command button

3. 放一个 200x200 pixel 的 Picture box

加入如下代码:

Option Explicit

Public Sub DrawPiePiece(lColor As Long, fStart As Double, fEnd As

Double)

Const PI As Double = 3.14159265359

Const CircleEnd As Double = -2 * PI

Dim dStart As Double

Dim dEnd As Double

Picture1.FillColor = lColor

Picture1.FillStyle = 0

dStart = fStart * (CircleEnd / 100)

dEnd = fEnd * (CircleEnd / 100)

Picture1.Circle (100, 100), 60, , dStart, dEnd

End Sub

Private Sub Command1_Click()

Picture1.ScaleMode = vbPixels

Call DrawPiePiece(QBColor(1), 0.001, 36)

Call DrawPiePiece(QBColor(2), 36, 55)

Call DrawPiePiece(QBColor(3), 55, 75)

Call DrawPiePiece(QBColor(4), 75, 99.999)

End Sub

试一下吧

用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)

VB 如何画饼图?

给你一个步骤吧.

设立一个圆心(即定一个点)

再按照用PI转角来画就行了.

最后加上你需要的颜色


标题名称:vb.net制作饼形图 winform饼图
链接URL:http://cdxtjz.cn/article/hhscje.html

其他资讯