I hosted a picturebox inside a WPF window inside a stackpanel. I put code to rotate the stackpanel but it doesn't also rotate its child elements, why? I want it to rotate the video stream inside the picturebox during runtime when clicking the rotate button. how do i do it?
private void rotate_Click(object sender, RoutedEventArgs e)
{
RotateTransform rotateTransform = new RotateTransform(45);
panel.RenderTransform = rotateTransform;
}
You can't rotate Windows Forms controls so you will need to replace the WindowsFormHost
with a WPF control to be able to rotate it:
A WindowsFormsHost cannot be rotated. To suppress this error, handle the LayoutError event and set ThrowException to false
Layout Considerations for the WindowsFormsHost Element: https://msdn.microsoft.com/en-us/library/ms744952%28v=vs.110%29.aspx
Windows Forms controls cannot be rotated or skewed. The WindowsFormsHost element raises the LayoutError event if you apply a skew or rotation transformation. If you do not handle the LayoutError event, an InvalidOperationException is raised.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.