Method CreateTrackbar
- Namespace
- OpenCvSharp
- Assembly
- OpenCvSharp.dll
CreateTrackbar(string, string, ref int, int, TrackbarCallbackNative?, nint)
Creates a trackbar and attaches it to the specified window. The function createTrackbar creates a trackbar(a slider or range control) with the specified name and range, assigns a variable value to be a position synchronized with the trackbar and specifies the callback function onChange to be called on the trackbar position change.The created trackbar is displayed in the specified window winName.
public static int CreateTrackbar(string trackbarName, string winName, ref int value, int count, TrackbarCallbackNative? onChange = null, nint userData = 0)
Parameters
trackbarNamestringName of the created trackbar.
winNamestringName of the window that will be used as a parent of the created trackbar.
valueintOptional pointer to an integer variable whose value reflects the position of the slider.Upon creation, the slider position is defined by this variable.
countintMaximal position of the slider. The minimal position is always 0.
onChangeTrackbarCallbackNativePointer to the function to be called every time the slider changes position. This function should be prototyped as void Foo(int, void*); , where the first parameter is the trackbar position and the second parameter is the user data(see the next parameter). If the callback is the NULL pointer, no callbacks are called, but only value is updated.
userDatanintUser data that is passed as is to the callback. It can be used to handle trackbar events without using global variables.
Returns
CreateTrackbar(string, string, int, TrackbarCallbackNative?, nint)
Creates a trackbar and attaches it to the specified window. The function createTrackbar creates a trackbar(a slider or range control) with the specified name and range, assigns a variable value to be a position synchronized with the trackbar and specifies the callback function onChange to be called on the trackbar position change.The created trackbar is displayed in the specified window winName.
public static int CreateTrackbar(string trackbarName, string winName, int count, TrackbarCallbackNative? onChange = null, nint userData = 0)
Parameters
trackbarNamestringName of the created trackbar.
winNamestringName of the window that will be used as a parent of the created trackbar.
countintMaximal position of the slider. The minimal position is always 0.
onChangeTrackbarCallbackNativePointer to the function to be called every time the slider changes position. This function should be prototyped as void Foo(int, void*); , where the first parameter is the trackbar position and the second parameter is the user data(see the next parameter). If the callback is the NULL pointer, no callbacks are called, but only value is updated.
userDatanintUser data that is passed as is to the callback. It can be used to handle trackbar events without using global variables.