扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:陶刚编译 来源:天极开发 2007年11月3日
关键字:
Imports SoftwareFX.ChartFX Imports System.Threading |
Dim t1 As Thread |
Private Sub Chart1_Load(ByVal sender As _ System.Object, ByVal e As System.EventArgs) Handles Chart1.Load 'x轴上每隔5点显示时间 Chart1.AxisX.Step = 5 '每个点之间用5象素间隔 Chart1.AxisX.PixPerUnit = 5 '使图表可以滚动 Chart1.Scrollable = True '打开和关闭通讯管道 Chart1.OpenData(COD.Values, 1, COD.Unknown) Chart1.CloseData(COD.Values) End Sub |
Public Class StockQuote '组件中图形的数量 Const NUM_SERIES = 1 Private lastPoint As Integer = 0 Dim stockPrice As Single Private pStockSymbol As String Private pStockSeries As Integer = 0 Private pChartControl As Chart WriteOnly Property StockSymbol() Set(ByVal Value) pStockSymbol = Value End Set End Property WriteOnly Property ChartControl() Set(ByVal Value) pChartControl = Value End Set End Property Public Sub InvokeWebService() Dim ws As New StockWS.Service1 For i As Integer = 0 To 10000 stockPrice = ws.getPrice(pStockSymbol) pChartControl.Invoke(New _ myDelegate(AddressOf updateChart), New Object() {}) '继续之前等待1秒钟 Thread.Sleep(1000) Next End Sub Public Delegate Sub myDelegate() Public Sub updateChart() pChartControl.OpenData(COD.Values, NUM_SERIES, COD.Unknown) pChartControl.Value(pStockSeries, lastPoint) = stockPrice '显示x轴上的时间 pChartControl.AxisX.Label(lastPoint) = DateTime.Now.ToShortTimeString lastPoint += 1 pChartControl.CloseData(COD.Values) '把滚动条移到最右边 pChartControl.AxisX.ScrollPosition = pChartControl.AxisX.ScrollSize End Sub End Class |
Private Sub btnGetStockQuote1_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles btnGetStockQuote1.Click Dim sq As New StockQuote sq.StockSymbol = cmbStocks1.SelectedItem sq.ChartControl = Chart1 t1 = New Thread(AddressOf sq.InvokeWebService) t1.Start() End Sub |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者