c#WPF图片框内的视频旋转
c# WPF video rotation inside picturebox
我在堆栈面板中的 WPF window 中托管了一个图片框。我放置了代码来旋转堆栈面板,但它并没有旋转它的子元素,为什么?我希望它在运行时单击旋转按钮时旋转图片框内的视频流。我该怎么做?
private void rotate_Click(object sender, RoutedEventArgs e)
{
RotateTransform rotateTransform = new RotateTransform(45);
panel.RenderTransform = rotateTransform;
}
您无法旋转 Windows Forms 控件,因此您需要将 WindowsFormHost
替换为 WPF 控件才能旋转它:
A WindowsFormsHost cannot be rotated. To suppress this error, handle the LayoutError event and set ThrowException to false
WindowsFormsHost 元素的布局注意事项: 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.
我在堆栈面板中的 WPF window 中托管了一个图片框。我放置了代码来旋转堆栈面板,但它并没有旋转它的子元素,为什么?我希望它在运行时单击旋转按钮时旋转图片框内的视频流。我该怎么做?
private void rotate_Click(object sender, RoutedEventArgs e)
{
RotateTransform rotateTransform = new RotateTransform(45);
panel.RenderTransform = rotateTransform;
}
您无法旋转 Windows Forms 控件,因此您需要将 WindowsFormHost
替换为 WPF 控件才能旋转它:
A WindowsFormsHost cannot be rotated. To suppress this error, handle the LayoutError event and set ThrowException to false
WindowsFormsHost 元素的布局注意事项: 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.