在 series 集合編輯器 里找到雜項(xiàng) customproperties 里的 pointwidth 設(shè)置
成都創(chuàng)新互聯(lián)公司于2013年成立,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項(xiàng)目成都網(wǎng)站設(shè)計(jì)、成都網(wǎng)站建設(shè)網(wǎng)站策劃,項(xiàng)目實(shí)施與項(xiàng)目整合能力。我們以讓每一個(gè)夢(mèng)想脫穎而出為使命,1280元太和做網(wǎng)站,已為上家服務(wù),為太和各地企業(yè)和個(gè)人服務(wù),聯(lián)系電話:028-86922220
引用microsoft chart control6.0(sp4)
添加mxchart空件
mxchart空件可以實(shí)現(xiàn)各種圖形,什么餅,柱,三角,線,都可以。而且可以是立體的。
chart控件和timer控件,用timer控件觸發(fā)chart控件中系列數(shù)據(jù)的更新。
'新建一個(gè)標(biāo)準(zhǔn)exe工程,畫一個(gè)command1,一個(gè)label,其index屬性設(shè)為0然后將代碼粘貼
Private Sub Command1_Click()
Static Ts As Integer
Ts = Ts + 1
x = InputBox("請(qǐng)輸入柱狀圖高度(1-19):")
If Val(x) 20 Or Val(x) = 0 Then
Ts = Ts - 1
MsgBox "請(qǐng)輸入0-19范圍的數(shù)"
Exit Sub
End If
Set newobj = Me.Controls.Add("vb.shape", "shape" Ts)
With newobj
.Shape = 0
.FillStyle = 5
.Left = 1 + 2 * Ts
.Top = 42 - x * 2
.Height = x * 2
.Width = 1
End With
newobj.Visible = True
End Sub
Private Sub Form_Load()
Me.Height = 9000
Me.Width = 19000
Me.AutoRedraw = True
Show
Me.ScaleHeight = 44 '將窗體的高設(shè)定為44份
Me.ScaleWidth = 50 '將窗體的寬設(shè)定為50份
'Me.Line.BorderColor = H0
Me.Line (2, 2)-(2, 42), H0 '畫出縱坐標(biāo)
Me.Line (2, 42)-(48, 42), H0 '畫出橫坐標(biāo)
Me.Line (48, 42)-(47.5, 41.5), H0 '畫出橫坐標(biāo)上的箭頭
Me.Line (48, 42)-(47.5, 42.5), H0
Me.Line (2, 2)-(1.75, 3), H0 '畫出縱坐標(biāo)上的箭頭
Me.Line (2, 2)-(2.25, 3), H0
Label1(0).Width = 20 '寫出坐標(biāo)原點(diǎn)
Label1(0).Height = 20
Label1(0).AutoSize = ture
Label1(0).BackStyle = 0
Label1(0).FontItalic = True
Label1(0).FontBold = True
Label1(0).FontSize = 10
Label1(0).ForeColor = HFF
Label1(0).Caption = 0
Label1(0).Left = 1.5
Label1(0).Top = 42.5
Label1(0).Visible = True
For i = 1 To 45
Load Label1(i) '用數(shù)組的方法動(dòng)態(tài)添加控件(橫坐標(biāo)示數(shù))
Label1(i).Width = 40
Label1(i).Height = 20
Label1(i).AutoSize = ture
Label1(i).BackStyle = 0
Label1(i).FontItalic = True
Label1(i).FontBold = True
Label1(i).FontSize = 10
Label1(i).ForeColor = HFF
Label1(i).Caption = i
Label1(i).Left = 1.5 + i
Label1(i).Top = 42.5
Label1(i).Visible = True
'動(dòng)態(tài)添加控件(橫坐標(biāo)上的間隔線)
Set newobj = Me.Controls.Add("vb.line", "Line" i)
With newobj
.BorderStyle = 3
.X1 = i + 2
.X2 = i + 2
.Y1 = 41.8
.Y2 = 42.2
End With
newobj.Visible = True
Next i
For i = 46 To 70
Load Label1(i)
Label1(i).Width = 40
Label1(i).Height = 20
Label1(i).AutoSize = ture
Label1(i).BackStyle = 0
Label1(i).FontItalic = True
Label1(i).FontBold = True
Label1(i).FontSize = 10
Label1(i).ForeColor = HFF
Label1(i).Caption = i - 45
Label1(i).Left = 1
Label1(i).Top = (66 - i) * 2
If Val(Label1(i).Caption) 20 Then Label1(i).Visible = True
Set newobj = Me.Controls.Add("vb.line", "Line" i)
With newobj
.X1 = 1.9
.X2 = 2.1
.Y1 = 2 * (i - 44)
.Y2 = 2 * (i - 44)
'.BorderStyle = 3
End With
newobj.Visible = True
Next i
End Sub
三個(gè)辦法,你自己選擇吧。
1、用圖形,自己畫。不要以為這個(gè)是胡扯,實(shí)際上任何一個(gè)圖形控件都是通過GUI這么畫出來的。你自己寫代碼畫沒有想象中那么難。我曾經(jīng)自己寫了一個(gè)控件,實(shí)現(xiàn)任務(wù)管理器里面CPU占用率顯示的那個(gè)效果,代碼也不過百多行,比大多數(shù)人想的都要容易。
2、用 Microsoft Chart Controls。mschart絕大多數(shù)機(jī)器上都有,能提供基本的圖形顯示。操作比較簡(jiǎn)單,相應(yīng)的功能也比較簡(jiǎn)單。但最常見的折線圖、餅圖、柱狀圖都是有的。
3、使用第三方控件。推薦 TeeChart,不過正版的要收費(fèi)。你能在網(wǎng)上找到破解的老版本。功能強(qiáng)大,畫面漂亮、圖形種類繁多,有動(dòng)態(tài)操作功能。什么坐標(biāo)啊,頂點(diǎn)標(biāo)簽啊,圖例啊等等全都有。
給個(gè)以前做的柱狀圖工程及代碼:
Option?Explicit
Dim?i?As?Long
Dim?record_jmm(10)?As?Single
Private?Sub?cmdExit_Click()
Unload?Me
End?Sub
Private?Sub?Form_Load()
For?i?=?0?To?30
Line?(350,?3960?+?i?*?141)-(450,?3960?+?i?*?141),?vbRed
Line?(1920?+?350,?3960?+?i?*?141)-(1920?+?450,?3960?+?i?*?141),?vbRed
Line?(1920?*?2?+?350,?3960?+?i?*?141)-(1920?*?2?+?450,?3960?+?i?*?141),?vbRed
Line?(1920?*?3?+?350,?3960?+?i?*?141)-(1920?*?3?+?450,?3960?+?i?*?141),?vbRed
Line?(1920?*?4?+?350,?3960?+?i?*?141)-(1920?*?4?+?450,?3960?+?i?*?141),?vbRed
Next
For?i?=?0?To?40
Line?(1920?*?5?+?450,?3960?+?i?*?105)-(1920?*?5?+?550,?3960?+?i?*?105),?vbRed
Next
For?i?=?0?To?4
Line?(1920?*?5?+?450,?3960?+?i?*?1050)-(1920?*?5?+?650,?3960?+?i?*?1050),?vbRed
Next
For?i?=?0?To?4
Line?(350?+?1920?*?i,?3960)-(350?+?1920?*?i,?3960?+?4235),?vbRed
Me.CurrentX?=?20?+?i?*?1920
Me.ForeColor?=?vbRed
Me.CurrentY?=?3880
Print?"150"
Me.CurrentX?=?20?+?i?*?1920
Me.CurrentY?=?3880?+?705
Print?"100"
Me.CurrentX?=?20?+?i?*?1920
Me.CurrentY?=?3880?+?705?*?2
Print?"?50"
Me.CurrentX?=?20?+?i?*?1920
Me.CurrentY?=?3880?+?705?*?3
Print?"??0"
Me.CurrentX?=?20?+?i?*?1920
Me.CurrentY?=?3880?+?705?*?4
Print?"-50"
Me.CurrentX?=?10?+?i?*?1920
Me.CurrentY?=?3880?+?705?*?5
Print?"-100"
Me.CurrentX?=?10?+?i?*?1920
Me.CurrentY?=?3880?+?705?*?6
Print?"-150"
Next
Me.CurrentX?=?20?+?5?*?1920
Me.ForeColor?=?vbYellow
Me.CurrentY?=?3880
Print?"10000"
Me.CurrentX?=?20?+?5?*?1920
Me.CurrentY?=?3880?+?1059
Print?"?1000"
Me.CurrentX?=?20?+?5?*?1920
Me.CurrentY?=?3880?+?1059?*?2
Print?"??100"
Me.CurrentX?=?20?+?5?*?1920
Me.CurrentY?=?3880?+?1059?*?3
Print?"???10"
Me.CurrentX?=?20?+?5?*?1920
Me.CurrentY?=?3880?+?1059?*?4
Print?"????1"
End?Sub
Private?Sub?Timer1_Timer()
For?i?=?0?To?5
PitBangtu(i).Cls
Next?i
PitBangtu(0).Line?(0,?2117.5?-?record_jmm(3)?*?42.35?/?3)-(1095,?4235),?vbRed,?BF
PitBangtu(1).Line?(0,?2117.5?-?record_jmm(4)?*?42.35?/?3)-(1095,?4235),?vbRed,?BF
PitBangtu(2).Line?(0,?2117.5?-?record_jmm(5)?*?42.35?/?3)-(1095,?4235),?vbRed,?BF
PitBangtu(3).Line?(0,?2117.5?-?record_jmm(6)?*?42.35?/?3)-(1095,?4235),?vbRed,?BF
PitBangtu(4).Line?(0,?2117.5?-?record_jmm(0)?*?42.35?/?3)-(1095,?4235),?vbRed,?BF
'PitBangtu(0).Line?(0,?2117.5?-?150?*?42.35?/?3)-(1095,?4235),?vbRed,?BF
If?Val(record_jmm(10))??10000?And?Val(record_jmm(10))?=?1000?Then
PitBangtu(5).Line?(0,?0?+?(10000?-?record_jmm(10))?*?0.1174)-(1095,?4235),?vbRed,?BF
ElseIf?Val(record_jmm(10))??1000?And?Val(record_jmm(10))?=?100?Then
PitBangtu(5).Line?(0,?1058.75?+?(1000?-?record_jmm(10))?*?1.1744)-(1095,?4235),?vbRed,?BF
ElseIf?Val(record_jmm(10))??100?And?Val(record_jmm(10))?=?10?Then
PitBangtu(5).Line?(0,?2117.5?+?(100?-?record_jmm(10))?*?11.744)-(1095,?4235),?vbRed,?BF
ElseIf?Val(record_jmm(10))??10?And?Val(record_jmm(10))?=?1?Then
PitBangtu(5).Line?(0,?3176.25?+?(10?-?record_jmm(10))?*?117.444)-(1095,?4235),?vbRed,?BF
End?If
End?Sub