
| Language: | Visual Basic 6 |
| Version: | 3.0.3 |
| Released on: | April 7, 2005 |
| Author: | IC Imaging Control Support Department |
| Requirements: | IC Imaging Control >2.1 Camera, converter or grabber with WDM Stream Class drivers. |
| |
IC Imaging Control offers the class VCDSimpleProperty to adjust device settings:
Private VCDProp As VCDSimpleProperty
The following programming example (Visual Basic) shows how you can use IC Imaging Control to create a dialog to adjust the parameter "Brightness". First of all, the programm checks whether the device provides an automatic mode for the parameter "Brightness". If this is not the case, it deactivates the dialog's check box "Auto" (chkBrightnessAuto.Enabled = False). If, however, the device offers an automatic mode, we explicitly switch it off (VCDProp.Automation(VCDID_Brightness = False):
Private Sub Form_Load() ' If no device is selected yet, show the device selection dialog If Not ICImagingControl1.DeviceValid Then ICImagingControl1.ShowDeviceSettingsDialog If Not ICImagingControl1.DeviceValid Then MsgBox "No device was selected." Unload Me Exit Sub End If End If ' Initialize the VCDProp class to access the properties of our ICImagingControl ' object Set VCDProp = GetSimplePropertyContainer(ICImagingControl1.VCDPropertyItems) ' Initialize the auto checkbox If Not VCDProp.AutoAvailable(VCDID_Brightness) Then chkBrightnessAuto.Enabled = False Else VCDProp.Automation(VCDID_Brightness) = False End If
In a second step, the programm checks whether the device provides a manual adjustment of the parameter "Brightness". If this is not the case, it deactivates the dialog's slider "Brightness" (sldBrightness.Enabled = False). If, however, the device offers a manual adjustment, the programm determines the smallest and the highest value provided by the device (VCDProp.RangeMin and VCDProp.RangeMax) as well as the current value (VCDProp.RangeValue). The program uses these values to initialize sldBrightness and lblBrightnessValue:
' Initialize the slider
If Not VCDProp.Available(VCDID_Brightness) Then
sldBrightness.Enabled = False
Else
sldBrightness.Enabled = True
sldBrightness.Min = VCDProp.RangeMin(VCDID_Brightness)
sldBrightness.Max = VCDProp.RangeMax(VCDID_Brightness)
sldBrightness.Value = VCDProp.RangeValue(VCDID_Brightness)
sldBrightness.TickFrequency = (sldBrightness.Max - sldBrightness.Min) / 10
lblBrightnessValue = sldBrightness.Value
End If
' start live mode
ICImagingControl1.LiveStart
End Sub
When the user modifies the slider's position (sldBrightness), the program writes the new "Brightness" value into the device (VCDProp.RangeValue(VCDID_Brightness)) and displays it in the dialog (lblBrightnessValue):
' The Slider's event handler Private Sub sldBrightness_Scroll() VCDProp.RangeValue(VCDID_Brightness) = sldBrightness.Value lblBrightnessValue = VCDProp.RangeValue(VCDID_Brightness) End Sub
When the user clicks the check box "Auto" (chkBrightnessAuto) to activate the automatic mode, our program enables this mode of the device (VCDProp.Automation(VCDID_Brightness) = True) and deactivates the slider (sldBrightness.Enabled = False):
' The CheckBoxes' event handlers Private Sub chkBrightnessAuto_Click() If chkBrightnessAuto.Value = 1 Then VCDProp.Automation(VCDID_Brightness) = True sldBrightness.Enabled = False Else VCDProp.Automation(VCDID_Brightness) = False sldBrightness.Enabled = True End If End Sub
The adjustment of other device settings follows the above scheme. Please find a list of settings offered by IC Imaging Control in the User's Guide.

Disclaimer
The source code that appears in the IC Imaging Control Source Code Library is indented for educational purposes only. The Imaging Source Europe GmbH, the manufacturer of IC Imaging Control, does not assume any kind of warranty expressed or implied, resulting from the use of the content of this page.