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.
I want to use something like the code below (in a WinForm) the get the screen location of a picture box:
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:
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.