首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > VB Dotnet >

drawline,该怎么处理

2012-02-08 
drawline那位大侠能给个画串口的曲线的例子,x轴是时间,y轴是串口值,谢谢!![解决办法]Net(C#)纯GDI+绘制实

drawline
那位大侠能给个画串口的曲线的例子,x轴是时间,y轴是串口值,谢谢!!

[解决办法]
Net(C#)纯GDI+绘制实时动态曲线图
http://hi.baidu.com/zhihongf/blog/item/f96cfa1fe561550a314e1571.html
[解决办法]
Public Function MakeLinePic(ByVal hostip As String, ByVal yourname As String, ByVal yourpassword As String, ByVal station As String, ByVal element As String, ByVal ObservTimes As String, ByVal sizea As Integer, ByVal XAddNum As Integer, ByVal YAddNum As Integer, ByVal k As Integer, ByVal element1 As String, ByVal ObservTimes1 As String, ByVal buchang As Integer) As Bitmap '画坐标曲线的方法

Dim mybitmap As Bitmap

Dim myds As DataSet

Dim maxnum, minnum As Single

Dim a, a1, a2, i, j, b, b1, b2 As Integer

If k = 0 Then

myds = readsqldb1S1E(hostip, yourname, yourpassword, station, element, ObservTimes, ObservTimes1)

ElseIf k = 1 Then

'myds = readsqldb2E(hostip, yourname, yourpassword, element, element1, ObservTimes)

ElseIf k = 2 Then

'myds = readsqldbsum(hostip, yourname, yourpassword, element, element1, ObservTimes, ObservTimes1)

End If

maxnum = Ceil(maxvaule(myds, 0, 1))

minnum = Floor(minvaule(myds, 0, 1))

a = (maxnum - minnum) / buchang

a1 = 420 / a

a2 = 420 / (maxnum - minnum)

mybitmap = New Bitmap(550, 530)

Dim ag As Graphics

ag = Graphics.FromImage(mybitmap)

ag.Clear(Color.White)

For i = 0 To a

DrawMapXY(mybitmap, New Pen(Color.Gray), 18, 438 - i * a1, 500, 438 - i * a1)

DrawWord1(mybitmap, 1, 438 - i * a1 - 3, minnum + i * buchang)

Next i

j = ObservTimes1 - ObservTimes

b = 500 / myds.Tables(0).Rows.Count

For i = 0 To myds.Tables(0).Rows.Count - 1

DrawMapXY(mybitmap, New Pen(Color.Gray), i * b + 18, 18, i * b + 18, 438)

DrawWord1(mybitmap, i * b + 15, 445, i)

Next i

For i = 0 To myds.Tables(0).Rows.Count - 2

DrawMapXY(mybitmap, New Pen(Color.Blue), i * b + 18, (420 - a2 * (myds.Tables(0).Rows(i)(1) - minnum) + 18), (i + 1) * b + 18, (420 - a2 * (myds.Tables(0).Rows(i + 1)(1) - minnum) + 18))

DrawEllipseXY2(mybitmap, i * b + 18, (420 - a2 * (myds.Tables(0).Rows(i)(1) - minnum) + 18), myds.Tables(0).Rows(i)(1), New SolidBrush(Color.Red))

Next i

DrawEllipseXY2(mybitmap, i * b + 18, (420 - a2 * (myds.Tables(0).Rows(i)(1) - minnum) + 18), myds.Tables(0).Rows(i)(1), New SolidBrush(Color.Red))

Return mybitmap

End Function

[解决办法]
学习
[解决办法]
http://hi.baidu.com/zhihongf/blog/item/f96cfa1fe561550a314e1571.html

热点排行