Pelco Developer Network (PDN)

Resize video window

I'm creating a simple windows form that displays video from a camera using the most recent version of the Pelco SDK (3.5 at the time). I can see video from the camera without problems, but when I try to resize the window (maximize for example), the video is not changing to the new size and the UI becomes unresponsive.

This is the part of the code where I handle resizing:

if (device.DeviceType == DeviceType.Camera)
{
_camera = new Camera(device);
_stream = new Stream(_camera);
Log.Debug("Stream loaded");

_stream.StreamConfig = GetStreamConfiguration();

// Set the handle for SDK
_display = new Display(Handle);

_display.Show(_stream);
SizeChanged += delegate
{

Log.Debug("Resizing stream to: " + Width + "x" + Height);
_display.DisplayRect = new Rectangle(0, 0, Width, Height);
};

//_stream.Timestamp += HandleTimestampEvent;
_stream.Play(Constants.kFWD_1X);
_stream.Volume = 0;
}

Does someone knows the correct way to resize a video stream or display in the new SDK ?

I realise this thread is very antiquated but hopefully the next person with the same issue reads this before spending too much time on it.
I encountered the same issue, and found that the Display object hangs if you try to resize it immediately on receiving the event. I created a timer to wait a short amount of time (42 milliseconds), after which I resize the display with a new Rectangle with the location and size of the containing Control. This solved the issue for me on both older (3.5.2) and the latest SDK (4.2.1).