How To: Handle Multiple Camera Parameter Types in a .NET User Control#
The "Live View" sample (pylon C# Windows Forms) uses user controls to access camera parameters. There are different user controls, depending on the parameter type (FloatSliderUserControl.cs, IntSliderUserControl.cs etc.).
Basler cameras support different versions of the GenICam Standard Feature Naming Convention (SFNC). As a result, the parameter types for a feature may differ from camera to camera.
One example is the Gain
parameter, which differs between the SFNC versions:
- Gain: Float parameter
- GainAbs: Float parameter
- GainRaw: Integer parameter
If you want to use different cameras in your application that have implemented different parameter types for a feature (like Gain) and present them in a GUI, you have two options:
- Place two user controls on the GUI. Depending on the parameter type, show one of them and hide the other.
- Implement both parameter types (integer, float) in the user control and switch between them as required.
The pylon Live View sample implements the new user control DualSliderUserControl.cs, which allows access to both, float parameters and integer parameters.
During initialization, depending on the camera type, either the float parameter or the integer parameter is bound to the camera feature. The use of the DualSliderUserControl
for the Gain
parameter is illustrated in MainForm.cs inside the deviceListView_SelectedIndexChanged()
event handler.