Automatically selects the nearest video source size to a preferred width and height.

procedure UseNearestVideoSize(PreferredWidth, PreferredHeight: LongInt; Stretch: Boolean);

void __fastcall UseNearestVideoSize(int PreferredWidth, int PreferredHeight, bool Stretch)

Sub UseNearestVideoSize(PreferredWidth As Long, PreferredHeight As Long, Stretch As Boolean)


Used to automatically use the video capture device size nearest to a preferred width and height.

- if stretch disabled, the control is resized to the nearest size found.
- if stretch enabled, the nearest size is selected, the control is resized to the preferred width and height, and the video window is stretched to fit the control.

E.g. we wish a 320x240 display size, and the video capture device offers only 176x144 and 352x288 sizes.
- UseNearestVideoSize (320, 240, false) selects the 352x288 video size and resize the display window to 352x288.
- UseNearestVideoSize (320, 240, true) selects the 352x288 video size and stretches the display window to 320x240.

Important note: when this function is called, the VideoSize property is ignored. To re-enable the VideoSize property, call UseNearestVideoSize (0, 0, false).

See Also
GetNearestVideoHeight GetNearestVideoSize GetNearestVideoWidth GetVideoHeightFromIndex GetVideoSizeFromIndex GetVideoWidthFromIndex VideoFormat VideoFormatIndex VideoSize VideoSizeIndex VideoSizes VideoSizesCount