Table of Contents

Class VideoView

Namespace
VisioForge.Core.UI.WinForms
Assembly
VisioForge.Core.dll

High-performance video view control for Windows Forms applications providing comprehensive video display capabilities.

This control serves as the primary video rendering component for WinForms applications, supporting multiple rendering modes including hardware-accelerated Direct2D, EVR (Enhanced Video Renderer), and software rendering. It integrates seamlessly with VisioForge media components for video capture, playback, and editing scenarios.

Key features:

  • Multiple rendering modes: Direct2D, EVR, MadVR, and software rendering
  • Hardware acceleration support for GPU decoding and high-resolution video
  • Picture box overlay for picture-in-picture functionality
  • Status overlay system for connection progress and notifications
  • Comprehensive error handling with debug log dialog
  • Mouse event forwarding for interactive video applications
  • Automatic aspect ratio handling and video transformations
  • Integration with MediaPlayer, VideoCapture, and VideoEdit components

Rendering modes:

  • Software: CPU-based rendering using GDI+ (compatible but slower)
  • Direct2D: Hardware-accelerated 2D rendering (recommended for most scenarios)
  • EVR: Windows Enhanced Video Renderer (excellent for video playback)
  • MadVR: High-quality video renderer for advanced video processing

Architecture:

  • Extends System.Windows.Forms.Panel for WinForms integration
  • Implements INotifyPropertyChanged for data binding support
  • Implements IVideoView for VisioForge framework integration
  • Provides event-driven architecture for media pipeline integration

Threading considerations:

  • UI operations must occur on the UI thread
  • Media events are marshaled to the UI thread automatically
  • Supports InvokeRequired pattern for cross-thread calls

Performance characteristics:

  • Hardware-accelerated rendering when available
  • Efficient frame delivery with minimal overhead
  • Automatic resource cleanup and disposal
  • Support for high-resolution video (4K/8K) with hardware acceleration

Common use cases:

  • Live video preview from capture devices
  • Video file playback applications
  • Video editing and processing tools
  • Security and surveillance systems
  • Video conferencing applications
  • Multi-camera monitoring systems
public class VideoView : Panel, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable, INotifyPropertyChanged, IVideoView

Inheritance

Implements

Inherited Members

Constructors

VideoView()

Initializes a new instance of the VisioForge.Core.UI.WinForms.VideoView class.

public VideoView()

Properties

Context

SDK logging context. Set by the engine via VisioForge.Core.Helpers.ContextPropagator when the view is attached. When null, render/lifecycle exceptions fall back to Trace.

[Browsable(false)]
public BaseContext Context { get; set; }

Property Value

BaseContext

StatusOverlay

Gets or sets the status overlay displayed during connection establishment and before video streaming begins.

The status overlay provides visual feedback to users during network connection establishment, particularly useful for IP cameras, RTSP streams, and other network-based video sources that require connection negotiation time. The overlay appears immediately after calling Start/StartAsync and remains visible until the first video frame is received or an error occurs.

Key features:

  • Appears automatically after Start/StartAsync call
  • Disappears when first video frame arrives
  • Supports custom text, positioning, and styling
  • Thread-safe property setting
  • No performance impact on video rendering

Common usage: Use VisioForge.Core.Types.TextStatusOverlay for text-based overlays with customizable:

  • Font and size
  • Text color and background
  • Position (center, top-left, etc.)
  • Text alignment
  • Custom messages ("Connecting...", "Loading...", etc.)

Custom implementations can provide:

  • Progress bars or spinners
  • Animated connection indicators
  • Branded loading screens
  • Multi-line status information

Thread safety: This property can be set from any thread. The overlay rendering occurs on the UI thread automatically.

Performance: Overlay rendering is lightweight and optimized. No impact on video performance once streaming begins.

public IStatusOverlay StatusOverlay { get; set; }

Property Value

IStatusOverlay

Methods

Attach(IMPVCVECore)

Attaches parent.

public void Attach(IMPVCVECore parent)

Parameters

parent IMPVCVECore

Parent.

CallInvoke(Delegate, params object[])

Calls the Invoke.

public void CallInvoke(Delegate method, params object[] args)

Parameters

method Delegate

The method.

args object[]

The arguments.

CallRefresh()

Calls the refresh.

public void CallRefresh()

ClearUI()

Clears the UI.

public void ClearUI()

Detach(IMPVCVECore)

Detaches parent.

public void Detach(IMPVCVECore parent)

Parameters

parent IMPVCVECore

Parent. If non-null and not the currently attached parent, the call is a no-op (mismatched detach).

Dispose(bool)

Dispose.

protected override void Dispose(bool disposing)

Parameters

disposing bool

Disposing parameter.

GetBackgroundColor()

Gets the color of the background.

public SKColor GetBackgroundColor()

Returns

SKColor

SKColor.

GetHandle()

Gets window handle.

public nint GetHandle()

Returns

nint

Returns IntPtr.

GetInvokeRequired()

Gets the invoke required.

public bool GetInvokeRequired()

Returns

bool

true if the invoke is required, false otherwise.

GetIsHandleCreated()

Gets the is handle created.

public bool GetIsHandleCreated()

Returns

bool

true if the handle is created, false otherwise.

GetSize()

Gets size.

public Size GetSize()

Returns

Size

Return VisioForge.Core.Types.Size.

GetUIEngine()

Gets UI engine.

public VideoViewUIEngine GetUIEngine()

Returns

VideoViewUIEngine

Returns VisioForge.Core.Types.VideoViewUIEngine.

InvokeStart()

Invokes Start().

public void InvokeStart()

InvokeStartComplete()

Invokes Start(), complete.

public void InvokeStartComplete()

InvokeStop()

Invokes Stop().

public void InvokeStop()

InvokeVideoRendererUpdate()

Invokes VideoRendererUpdate().

public void InvokeVideoRendererUpdate()

LogDialogClear()

Clears logs dialog.

public void LogDialogClear()

LogDialogClose()

Closes logs dialog.

public void LogDialogClose()

LogDialogError(string)

Logs the error in a custom dialog.

public void LogDialogError(string msg)

Parameters

msg string

The message.

OnPaint(PaintEventArgs)

OnPaint override.

protected override void OnPaint(PaintEventArgs e)

Parameters

e PaintEventArgs

Event args.

OnPropertyChanged(string)

OnPropertyChanged API.

protected virtual void OnPropertyChanged(string propertyName = null)

Parameters

propertyName string

Property name.

PictureBoxCreate(int, int)

Create the PictureBox.

public void PictureBoxCreate(int width, int height)

Parameters

width int

The width.

height int

The height.

PictureBoxDestroy()

Destroys the PictureBox.

public void PictureBoxDestroy()

PictureBoxExists()

Is the PictureBox exists.

public bool PictureBoxExists()

Returns

bool

true if exists, false otherwise.

PictureBoxGetImage()

Gets the PictureBox image.

public Bitmap PictureBoxGetImage()

Returns

Bitmap

Bitmap.

PictureBoxSetImage(Bitmap)

Set the image on PictureBox.

public void PictureBoxSetImage(Bitmap image)

Parameters

image Bitmap

The image.

PushMouseButtonDown(int, int, MouseButton)

Pushes the mouse button down.

public void PushMouseButtonDown(int x, int y, MouseButton button)

Parameters

x int

The x.

y int

The y.

button MouseButton

The button.

PushMouseButtonUp(int, int, MouseButton)

Pushes the mouse button up.

public void PushMouseButtonUp(int x, int y, MouseButton button)

Parameters

x int

The x.

y int

The y.

button MouseButton

The button.

PushMouseMove(int, int)

Pushes the mouse move.

public void PushMouseMove(int x, int y)

Parameters

x int

The x.

y int

The y.

ResizeRoundTo(int)

Resizes the VideoView round to value.

public void ResizeRoundTo(int round)

Parameters

round int

The value.

SetHandle(nint)

Sets the handle. Not implemented.

public void SetHandle(nint handle)

Parameters

handle nint

The handle.

Exceptions

NotImplementedException

Not implemented.

ShowMessage(string)

Shows the message.

public MessageBoxResult ShowMessage(string message)

Parameters

message string

The message.

Returns

MessageBoxResult

MessageBoxResult.

OnMouseButtonDown

Occurs when mouse button down.

public event EventHandler<MouseButtonEventArgs> OnMouseButtonDown

Event Type

EventHandler<MouseButtonEventArgs>

OnMouseButtonUp

Occurs when mouse button up.

public event EventHandler<MouseButtonEventArgs> OnMouseButtonUp

Event Type

EventHandler<MouseButtonEventArgs>

OnMouseMoved

Occurs when mouse moved.

public event EventHandler<MouseMoveEventArgs> OnMouseMoved

Event Type

EventHandler<MouseMoveEventArgs>

PropertyChanged

Property changed event.

public event PropertyChangedEventHandler PropertyChanged

Event Type

PropertyChangedEventHandler