| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 398 人关注过本帖
标题:time控件的卡顿问题
只看楼主 加入收藏
wxadrtyu
Rank: 1
等 级:新手上路
帖 子:7
专家分:0
注 册:2013-12-20
结帖率:0
收藏
 问题点数:0 回复次数:0 
time控件的卡顿问题
用来检测物体的灰度值的代码,为什么用久了会卡
[code][/Private Sub Timer1_Timer()
 Dim h As Long, dc As Long
 Dim Xa As Long, Xb As Long, Xc As Long, Xd As Long, Xe As Long

 Dim Ra As Byte, Ga As Byte, Ba As Byte, Rb As Byte, Gb As Byte, Bb As Byte, Rc As Byte, Gc As Byte, Bc As Byte, Rd As Byte, Gd As Byte, Bd As Byte, Re As Byte, Ge As Byte, Be As Byte

 dc = GetDC(0)
 Xa = GetPixel(dc, heng, zong)
 Ra = (Xa Mod 256) \ 16
 Ga = (Xa Mod 65536) \ 256
 Ba = (Xa Mod 16777216) \ 65536
 ReleaseDC dc, 0
 Na = Ra / 3 + Ga / 3 + Ba / 3
 Za = Int(Abs(Na - Ca))

 Xb = GetPixel(dc, heng - 16, zong)
 Rb = (Xb Mod 256) \ 16
 Gb = (Xb Mod 65536) \ 256
 Bb = (Xb Mod 16777216) \ 65536
 ReleaseDC dc, 0
 Nb = Ra / 3 + Ga / 3 + Ba / 3
 Zb = Int(Abs(Nb - Cb))

 Xc = GetPixel(dc, heng + 16, zong)
 Rc = (Xc Mod 256) \ 16
 Gc = (Xc Mod 65536) \ 256
 Bc = (Xc Mod 16777216) \ 65536
 ReleaseDC dc, 0
 Nc = Rc / 3 + Gc / 3 + Bc / 3
 Zc = Int(Abs(Nc - Cc))

 Xd = GetPixel(dc, heng + 8, zong)
 Rd = (Xd Mod 256) \ 16
 Gd = (Xd Mod 65536) \ 256
 Bd = (Xd Mod 16777216) \ 65536
 ReleaseDC dc, 0
 Nd = Rd / 3 + Gd / 3 + Bd / 3
 Zd = Int(Abs(Nd - Cd))

 Xe = GetPixel(dc, heng - 8, zong)
 Re = (Xc Mod 256) \ 16
 Ge = (Xc Mod 65536) \ 256
 Be = (Xc Mod 16777216) \ 65536
 ReleaseDC dc, 0
 Ne = Re / 3 + Ge / 3 + Be / 3
 Ze = Int(Abs(Ne - Ce))



 Text5.Text = Za & "*" & Zb & "*" & Zc & "*" & Zd & "*" & Ze

 If Za > 25 Or Zb > 25 Or Zc > 25 Or Zc > 25 Or Zc > 25 Then
 Sleep (50)
 Else
 Exit Sub
 End If
 If Za > 25 Or Zb > 25 Or Zc > 25 Or Zc > 25 Or Zc > 25 Then
 M = M + 1
 Text1.Text = M & "辆"
T1 = GetTickCount()
 DoEvents
 Sleep (50)
 Else
 Exit Sub
 End If
 Timer2.Enabled = True
 DoEvents
 Timer1.Enabled = False
 End Subcode]
搜索更多相关主题的帖子: 检测 
2014-01-23 14:33
快速回复:time控件的卡顿问题
数据加载中...
 
   



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

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