01.
private
void
timer2_Tick(
object
sender, EventArgs e)
02.
{
03.
if
(checkBox4.Checked){
04.
int
w, h, x2, y2;
05.
String ds;
06.
w = vcx.VideoWidth;
07.
h = vcx.VideoHeight;
08.
09.
Bitmap bb=
new
Bitmap(w, h, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
10.
Graphics g = Graphics.FromImage(bb);
11.
g.FillRectangle(Brushes.White, 0, 0, w, h);
12.
13.
14.
15.
ds = vcx.DetectMotionRects(2);
16.
if
(ds !=
null
)
17.
{
18.
Array d;
19.
d = ds.Split(
','
);
20.
21.
if
(d.GetLength(0) > 1)
22.
{
23.
int
f = 1;
24.
if
(Convert.ToInt32(d.GetValue(f)) > 5)
25.
{
26.
vcx.CapFilename = textBox1.Text;
27.
vcx.StartCapture();
28.
x2 = (w);
29.
y2 = (h);
30.
g.DrawRectangle(Pens.Red, 0, 0, x2 - 2, y2 - 1);
31.
}
32.
else
33.
vcx.StopCapture();
34.
}
35.
36.
}
37.
38.
g.Dispose();
39.
40.
DeleteObject(oldbh);
41.
IntPtr bh= bb.GetHbitmap();
42.
vcx.SetBitmapOverlay((
int
)bh, 0, 0, 0xFFFFFF, 255);
43.
oldbh = bh;
44.
}
45.
}