扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
Public Function getPrice(ByVal stock As String) As Single Return Rnd() * 100 End Function |
图1:解决方案浏览器中的项目-图中显示了StockWS Web服务项目和 |
图2:工具盒中的Chart组件-你需要从网站上下载并安装Chart FX组件30天试用版。 |
图3:Stock Quote主窗体-图中显示了添加适当的控件之后窗体样式。 |
图4:Chart组件的格式化向导-该向导为Chart组件提供了大量的格式化选项。 |
'Chart1 Me.Chart1.AxisX.Staggered = True Me.Chart1.AxisX.Step = 10 Me.Chart1.AxisY.Step = 10 Me.Chart1.BackObject = GradientBackground1 Me.Chart1.DataStyle =SoftwareFX.ChartFX.DataStyle.ReadXValues Me.Chart1.DesignTimeData = _ "C:\Program Files\ChartFX for .NET 6.2\Wizard\XYZero.txt" Me.Chart1.Gallery = SoftwareFX.ChartFX.Gallery.Lines Me.Chart1.InsideColor = System.Drawing.Color.Transparent Me.Chart1.LineWidth = 3 Me.Chart1.Location = New System.Drawing.Point(40, 16) Me.Chart1.MarkerShape =SoftwareFX.ChartFX.MarkerShape.None Me.Chart1.Name = "Chart1" Me.Chart1.NSeries = 1 Me.Chart1.NValues = 20 Me.Chart1.Palette = "HighContrast.HighContrast" Me.Chart1.PointLabels = True Me.Chart1.Size = New System.Drawing.Size(656, 216) Me.Chart1.TabIndex = 12 Me.Chart1.Titles.AddRange(New _ SoftwareFX.ChartFX.TitleDockable(){TitleDockable1}) |
Me.cmbStocks1.Items.AddRange(New String() {"MSFT", "SUN", "YHOO", "GE"}) |
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 stockPric |