| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 572 人关注过本帖
标题:实时曲线移植到多窗体工程的问题
取消只看楼主 加入收藏
quanquanwang
Rank: 2
等 级:论坛游民
帖 子:25
专家分:39
注 册:2011-11-14
结帖率:16.67%
收藏
已结贴  问题点数:20 回复次数:2 
实时曲线移植到多窗体工程的问题
单窗体可以显示的实时曲线,移植到多窗体中无法显示是什么情况?请高手指点
搜索更多相关主题的帖子: 曲线 
2012-12-26 11:47
quanquanwang
Rank: 2
等 级:论坛游民
帖 子:25
专家分:39
注 册:2011-11-14
收藏
得分:0 
回复 2楼 风吹过b
直接用picture.line写的,后面用到bitblt函数,都是在当前窗体中的。
下面是源代码:
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal VbSrcCopy As Long) As Long
Public s As Long
Dim x As Single
Dim hvar As Long
Dim y(0) As Single

Private Sub Command1_Click()
  Picture1.Refresh
 Timer1.Enabled = True
 Timer1.Interval = 20
Call AdsOcx1.AdsCreateVarHandle("MAX1.x", hvar)
End Sub

Private Sub Form_Load()
 AdsOcx1.EnableErrorHandling = True
 AdsOcx1.AdsAmsServerNetId = AdsOcx1.AdsAmsClientNetId
 AdsOcx1.AdsAmsServerPort = 801                  'CX1000的Run-Time System 1的端口号
 AdsOcx1.AdsAmsConnect
 Call AdsOcx1.AdsCreateVarHandle("MAX1.x", hvar)
Picture1.Scale (-4400, 2600)-(4400, -2600)
  Picture1.ScaleMode = 1
  Picture1.Refresh
  Picture1.AutoRedraw = True
  s = 200

End Sub

Private Sub Form_Unload(Cancel As Integer)
  Call AdsOcx1.AdsDeleteVarHandle(hvar)
    AdsOcx1.AdsAmsDisconnect
End Sub

Private Sub Timer1_Timer()
'Read variable
Call AdsOcx1.AdsSyncReadSingleVarReq(hvar, 4, x)
Text1.Text = CStr(x)

Call AdsOcx1.AdsSyncReadReq(&HF030&, 100&, 4&, y)
Text2.Text = CStr(y(0))

Dim w As Long, h As Long, y1 As Single, m As Single
Dim hBmp As Long, ShowMode As Long, ii As Long, t1 As Integer
w = Picture1.Width
h = Picture1.Height
hBmp = Picture1.hDC
ShowMode = &HCC0020 'ROP模式(复制)
Picture1.DrawWidth = 1
y1 = (s - y(0)) / s * h * 2 - 5000

ii = BitBlt(hBmp, 0, 0, w - 6, h, hBmp, -1, 0, ShowMode)
Picture1.Line (w - 1, m)-(w, y1), RGB(255, 0, 0)
m = y1
End Sub
求指点!
2012-12-26 15:34
quanquanwang
Rank: 2
等 级:论坛游民
帖 子:25
专家分:39
注 册:2011-11-14
收藏
得分:0 
回复 4楼 风吹过b
没用MDI窗体啊 ,直接添加了多个窗体。利用picturebox画图时,应该不用进行什么特殊的属性设置吧?
2012-12-26 21:01
快速回复:实时曲线移植到多窗体工程的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.032867 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved