You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 22, 2024. It is now read-only.
I want to use something like the code below (in a WinForm) the get the screen location of a picture box:
Point previewPos = PointToScreen(QrCodePreview.Location);
Rectangle screenPosition = new Rectangle(previewPos.X, previewPos.Y, QrCodePreview.Width, QrCodePreview.Height);
This works fine a give me the current screen location of a previewbox inside the WinForm dialog. After this I want to use code like the one below to attach the camera preview port to that screen location:
PreviewConfiguration previewConfig = new PreviewOverlayConfiguration
{
FullScreen = false,
PreviewWindow = screenPosition,
Layer = 1,
Opacity = 255
};
var video = new MMALVideoRenderer(previewConfig);
cam.Camera.PreviewPort.ConnectTo(video);
This works fine to. I get a very fast preview of the camera that is overlayed onto the picturebox item inside the dialog. But obviously as soon as I move and/or resize the dialog the screen coordinates of the preview port must be updated. I tried code like to one above inside a "changed size/position" handler but new settings had no effect. It seems that I miss something to attach a new previewport configuration.