求VB高手,解答一下啥意思。

PrivateSubexit_Click()'onlyifrunning...If(Timer1.Enabled)ThenTimer1.Enabled=False'Sto... Private Sub exit_Click()
' only if running...
If (Timer1.Enabled) Then
Timer1.Enabled = False 'Stop Timer
VideoOCX.Stop
VideoOCX.Close
End If
End
End Sub

Private Sub Start_Click() 'Init VideoOCX Control, allocate memory and start grabbing
If (Not Timer1.Enabled) Then
Start.Caption = "Stop"
' Disable internal error messages in VideoOCX
VideoOCX.SetErrorMessages False
' Init control
If (Not VideoOCX.Init) Then
' Init failed. Display error message and end sub
MsgBox VideoOCX.GetLastErrorString, vbOKOnly, "VideoOCX Error"
End
Else
' Allocate memory for global image handle
capture_image = VideoOCX.GetColorImageHandle
' result_image = VideoOCX_Processed.GetColorImageHandle
Timer1.Enabled = True 'Start capture timer
' Start Capture mode
If (Not VideoOCX.Start) Then
' Start failed. Display error message and end sub
MsgBox VideoOCX.GetLastErrorString, vbOKOnly, "VideoOCX Error"
End
End If
End If
Else
Start.Caption = "Start"
Timer1.Enabled = False 'Stop Timer
VideoOCX.Stop
VideoOCX.Close
End If
End Sub

Private Sub Timer1_Timer()
' Timer for capturing - handles videoOCXTools
Dim matrix As Variant
Dim height, width As Integer
Dim r, c As Integer
Dim max_r, max_c As Integer
Dim max_red As Integer
Dim gain, offset As Variant
Dim h_cm As Variant
Dim range As Integer
Dim pixels_from_center As Integer
' Calibrated parameter for pixel to distance conversion
gain = 0.0024259348
offset = -0.056514344
h_cm = 5.842

max_red = 0

' Capture an image
If (VideoOCX.Capture(capture_image)) Then

' VideoOCX.Show capture_image

' Matrix transformation initialization
matrix = VideoOCX.GetMatrix(capture_image)

height = VideoOCX.GetHeight
width = VideoOCX.GetWidth

' Image processing code
展开
 我来答
yangxunyi2
2012-11-20
知道答主
回答量:22
采纳率:0%
帮助的人:7.8万
展开全部
Private Sub exit_Click() exit按钮单击事件
' only if running...
If (Timer1.Enabled) Then 条件语句“假如时间控件处于活动状态时执行 if ...then 和 end if 之间的语句
Timer1.Enabled = False 时间控件失去焦点,停止计时
VideoOCX.stop 停止播放
VideoOCX.Close 关闭播放设备
End If
End
End Sub

Private Sub Start_Click() 'Init VideoOCX Control, allocate memory and start grabbing 注释同上
If (Not Timer1.Enabled) Then
Start.Caption = "Stop" 设置按钮名称
' Disable internal error messages in VideoOCX
VideoOCX.SetErrorMessages False
' Init control
If (Not VideoOCX.Init) Then
' Init failed. Display error message and end sub
MsgBox VideoOCX.GetLastErrorString, vbOKOnly, "VideoOCX Error" 弹出信息窗口
End
Else
' Allocate memory for global image handle
capture_image = VideoOCX.GetColorImageHandle
' result_image = VideoOCX_Processed.GetColorImageHandle
Timer1.Enabled = True 'Start capture timer
' Start Capture mode
If (Not VideoOCX.Start) Then
' Start failed. Display error message and end sub
MsgBox VideoOCX.GetLastErrorString, vbOKOnly, "VideoOCX Error"
End
End If
End If
Else
Start.Caption = "Start"
Timer1.Enabled = False 'Stop Timer
VideoOCX.Stop
VideoOCX.Close
End If
End Sub

Private Sub Timer1_Timer()
' Timer for capturing - handles videoOCXTools
Dim matrix As Variant
Dim height, width As Integer
Dim r, c As Integer
Dim max_r, max_c As Integer
Dim max_red As Integer
Dim gain, offset As Variant
Dim h_cm As Variant
Dim range As Integer
Dim pixels_from_center As Integer
xzqsr2010
2012-11-18 · TA获得超过430个赞
知道小有建树答主
回答量:407
采纳率:0%
帮助的人:279万
展开全部
这是一个叫做exit的控件的Click过程。
' only if running...... 是注释,对程序无影响。
在这个过程后加上你想要的代码,则执行Click过程(鼠标点击)则会出发代码。如:
Private Sub exit_Click() ' only if running......
'改成你的代码
End Sub
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式