View Full Version : Vb2005

July 31, 2007, 02:25:20
I'm new to programming with Basic, and I've encountered some difficulties implementing your sample code in VB2005.

I'd like to create a program that displays two DFK camera feeds (no problem), and allows image capture in both views as well as crosshair overlays. Could you assist me in adapting the sample code to account for changes in Visual Basic 2005?

Thank you.

Stefan Geissler
July 31, 2007, 08:08:08
Hi Blenny01,

For changing the mouse cursor please refer to following sample:

I hope, this helps.

July 31, 2007, 13:04:36
Thank you for the help, Stefan. Changing the mouse cursor is working fine now.

I'd like to be able to place alignment markers/crosshairs over the live video feed, but it appears there are some aspects of the moveable crosshairs (http://www.imagingcontrol.com/library/vb6/section/live-display/example/overlay-moveable-crosshairs/) sample that are not compatible with Visual Basic 2005. I've fixed the lines that define the colors and position of the crosshairs, but the If Then statement refers to a vbshiftmask property that I'm not familiar with and that VB2005 does not recognize either.

I assume this statement is checking for the user pressing the shift key for multiple crosshairs, but I'm not sure how to fix it for VB2005.

Stefan Geissler
July 31, 2007, 16:24:59

The .NET sample (C#) can be found at: http://www.imagingcontrol.com/library/dotnet/section/live-display/example/overlay-moveable-crosshairs/ . This should be nearly the same as in Visual Basic .NET.

August 15, 2007, 21:07:37
Thank you for the help. I have the cross-hair overlay working now.

However, if I downscale the size of the ImagingControl component in my form, the position of the crosshair display routine does not work correctly. How do I compensate for the scaling routine?

Sascha Schmidt
August 16, 2007, 16:47:45
Hallo Blenny01,

generally it is so, that you will lost pixel when scaling.
Normally the overlay bitmap automatically scales with the LiveDisplay. Therefore I can't understand the problem.

For example:
The live display - size is 640x480 and you place an crosshair at 320x240. When scaling to 50% ( .LiveDisplayZoomFactor = 0.5 ), the cross hair position automatically is still in the middle of the live display.
For a manually position compensation, you have to multiply/divide with the scaling factor.

Please send me a sample program which shows the problem. Then I can help you in a more efficient way.

August 17, 2007, 01:35:32
I've attached the VB2005 project in a zip file. As it currently is, if I click in the center of my scaled video feed, the crosshair appears half as small and in the center of the upper left quadrant.

Thanks for your help.

Sascha Schmidt
August 17, 2007, 12:13:32

As described above, you have to compensate the positions by dividing through the scaling factor:

Dim scaleX As Double
Dim scaleY As Double


scaleX = IcImagingControl1.LiveDisplayWidth / IcImagingControl1.ImageWidth
scaleY = IcImagingControl1.LiveDisplayHeight / IcImagingControl1.ImageHeight


DisplayCrosshairs(e.x / scaleX, e.y / scaleY)The adapted Sample is attached.