VB mschart控制項的使用

2021-04-29 16:57:59 字數 4128 閱讀 6423

private sub form_load()

dim mydata(20, 1) as double

'-----x軸座標值-----y軸座標值----------

mydata(0, 0) = 0: mydata(0, 1) = 180 '本句代表了:第一點資料的x軸座標為0,y軸座標為180

mydata(1, 0) = 6: mydata(1, 1) = 60

mydata(2, 0) = 8: mydata(2, 1) = 60

mydata(3, 0) = 11: mydata(3, 1) = 0

mydata(4, 0) = 16: mydata(4, 1) = 0

mydata(5, 0) = 19: mydata(5, 1) = 60

mydata(6, 0) = 25.8: mydata(6, 1) = 60

mydata(7, 0) = 28.8: mydata(7, 1) = 0

mydata(8, 0) = 31.8: mydata(8, 1) = 60

mydata(9, 0) = 40.3: mydata(9, 1) = 60

mydata(10, 0) = 43.3: mydata(10, 1) = 0

mydata(11, 0) = 93.3: mydata(11, 1) = 0

mydata(12, 0) = 96.3: mydata(12, 1) = 60

mydata(13, 0) = 99.3: mydata(13, 1) = 0

mydata(14, 0) = 105.3: mydata(14, 1) = 0

mydata(15, 0) = 135.3: mydata(15, 1) = 0

mydata(16, 0) = 144.3: mydata(16, 1) = 180

mydata(17, 0) = 148.8: mydata(17, 1) = 270

mydata(18, 0) = 405.03: mydata(18, 1) = 270

mydata(19, 0) = 409.53: mydata(19, 1) = 180

mydata(20, 0) = 564.17: mydata(20, 1) = 180

'波形圖外觀設定

with mschart1

.titletext = "速度 m/min"

'    '設定圖線的外觀

.plot.seriescollection(1).pen.width = 30

.plot.seriescollection(1).pen.style = vtpenstylesolid

'    '設定xy軸

.plot.axis(vtchaxisidx).valuescale.auto = false

.plot.axis(vtchaxisidy).valuescale.auto = false

'// 設定最大值

.plot.axis(vtchaxisidx).valuescale.maximum = 600 '設定橫軸標註最大值

.plot.axis(vtchaxisidy).valuescale.maximum = 300 '設定縱軸標註最大值

'// 設定最小值

.plot.axis(vtchaxisidy).valuescale.minimum = 0

.plot.axis(vtchaxisidx).valuescale.minimum = 0

'//.plot.axis(vtchaxisidx).valuescale.majordivision = 6 'x軸主要網格數量

.plot.axis(vtchaxisidy).valuescale.majordivision = 6 'y軸主要網格數量

.plot.axis(vtchaxisidx).valuescale.minordivision = 0 'x軸次要網格數量

.plot.axis(vtchaxisidy).valuescale.minordivision = 0 'y軸次要網格數量

.plot.axis(vtchaxisidx).axisgrid.majorpen.style = vtpenstyledotted

.plot.axis(vtchaxisidy).axisgrid.majorpen.style = vtpenstyledotted

mschart1.plot.autolayout = false

mschart1.plot.uniformaxis = false

mschart1.charttype = vtchcharttype2dxy '設定圖形為二維散點圖

mschart1.chartdata = mydata '資料

end with

end sub

private sub button2_click(byval sender as system.object, byval e as system.eventargs) handles button2.click

me.axmschart1.charttype = mschart20lib.vtchcharttype.vtchcharttype2dline

me.axmschart1.chartdata = x

dim i as integer

for i = 1 to me.axmschart1.rowcount

if i mod 3 = 0 then

axmschart1.row = i

axmschart1.rowlabel = "第" + i.tostring + "周"

else

axmschart1.row = i

axmschart1.rowlabel = ""

end if

next

dim currentaxis as mschart20lib.axis

dim currentlabel as mschart20lib.label

' get a reference to the y axis

currentaxis = axmschart1.plot.axis(mschart20lib.vtchaxisid.vtchaxisidy)

debug.writeline(currentaxis.axistitle)

' loop through and set the font of each label

for each currentlabel in currentaxis.labels

currentlabel.vtfont.name = "courier"

currentlabel.vtfont.size = 16

next currentlabel

for i = 1 to 2

axmschart1.plot.seriescollection(i).legendtext = "y" & i

next i

axmschart1.plot.seriescollection(1).pen.width = 30

axmschart1.plot.seriescollection(1).pen.style = mschart20lib.vtpenstyle.vtpenstylesolid

axmschart1.plot.autolayout = false

axmschart1.plot.uniformaxis = false

axmschart1.plot.axis(mschart20lib.vtchaxisid.vtchaxisidy).valuescale.auto = false

axmschart1.plot.axis(mschart20lib.vtchaxisid.vtchaxisidy).valuescale.minimum = 0

axmschart1.plot.axis(mschart20lib.vtchaxisid.vtchaxisidy).valuescale.maximum = 1000

axmschart1.plot.axis(mschart20lib.vtchaxisid.vtchaxisidy).valuescale.majordivision = 5

axmschart1.plot.axis(mschart20lib.vtchaxisid.vtchaxisidy).valuescale.minordivision = 1

end sub

HiddenField控制項的使用

asp.net2.0 hiddenfield控制項 1 2007 05 12 23 18hiddenfield控制項顧名思義就是隱藏輸入框的伺服器控制項,它能讓你儲存那些不需要顯示在頁面上的且對安全性要求不高的資料。也許這個時候應該有這麼乙個疑問,為什麼有了viewstate session和coo...

HiddenField控制項的使用

asp.net2.0 hiddenfield控制項 1 2007 05 12 23 18hiddenfield控制項顧名思義就是隱藏輸入框的伺服器控制項,它能讓你儲存那些不需要顯示在頁面上的且對安全性要求不高的資料。也許這個時候應該有這麼乙個疑問,為什麼有了viewstate session和coo...

Date Time Picker控制項的使用

首先,不管怎麼樣,控制項是要往視窗上拖的,所以你得準備乙個對話方塊。然後,把date time picker拖放到對話方塊上。接下來設定它的屬性,右鍵單擊該控制項,彈出屬性對話方塊。在general屬性頁中,給它取個名字,其它預設就可以了。在styles屬性頁中,format下拉框中,選擇long ...