应用RotateFlip时,System.Drawing.Imaging.Metafile始终抛出System.NotImplementedException [英] System.Drawing.Imaging.Metafile always throws System.NotImplementedException on applying RotateFlip
问题描述
你好团队,
我在我的项目中使用System.Drawing.Imaging.Metafile。我尝试使用与下面的代码片段相同的RotateFlip选项旋转相同的内容。
Metafile.RotateFlip(RotateFlipType.Rotate90FlipNone);
但它总是抛出System.NotImplementedException,但使用Bitmap时工作正常。这是一个已知问题吗?
请在下面找到堆栈跟踪详细信息。
System.NotImplementedException未处理
>
HResult = -2147467263
消息=未实现。
>
来源= System.Drawing
StackTrace:
at System.Drawing.Image.RotateFlip(RotateFlipType rotateFlipType)
at ................................. .........................
任何帮助都将受到高度赞赏。
谢谢,
Deepak,
对不起我迟到的回复。
>>但它总是抛出System.NotImplementedException
图元文件是一个绘图命令列表,而不是光栅表示,因此旋转翻转不起作用。
所以请将元文件绘制到位图然后旋转:
位图位图;
private void Form2_Load(object sender,EventArgs e)
{
bitmap =(Bitmap)Bitmap.FromFile(@" C:\ Users \v-baf \ OneDrive \ MyPicture\Sight.jpg");
pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
pictureBox1.Image = bitmap;
}
private void button1_Click(object sender,EventArgs e)
{
bitmap.RotateFlip(RotateFlipType.Rotate90FlipNone);
pictureBox1.Image = bitmap;
}希望有所帮助!
最好的问候,
Stanly
Hi team,
I am using System.Drawing.Imaging.Metafile in my project. i tried to rotate the same using RotateFlip option of the same as in the below code snippet.
Metafile.RotateFlip(RotateFlipType.Rotate90FlipNone);
But it always throw System.NotImplementedException, but the same is working fine while using Bitmap. Is this a known issue?
Please find the stack trace details below.
System.NotImplementedException was unhandled
HResult=-2147467263
Message=Not implemented.
Source=System.Drawing
StackTrace:
at System.Drawing.Image.RotateFlip(RotateFlipType rotateFlipType)
at ..........................................................
Any help would be highly appreciated.
Thanks,
Hi Deepak,
Sorry for my late reply.
>>But it always throw System.NotImplementedException
Metafiles are a list of drawing commands, not a raster representation so the rotate flip doesn't work.
So please draw the metafile to a bitmap and then rotate that:
Bitmap bitmap; private void Form2_Load(object sender, EventArgs e) { bitmap = (Bitmap)Bitmap.FromFile(@"C:\Users\v-baf\OneDrive\MyPicture\Sight.jpg"); pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize; pictureBox1.Image = bitmap; } private void button1_Click(object sender, EventArgs e) { bitmap.RotateFlip(RotateFlipType.Rotate90FlipNone); pictureBox1.Image = bitmap; }Hope it helps!
Best Regards,
Stanly
这篇关于应用RotateFlip时,System.Drawing.Imaging.Metafile始终抛出System.NotImplementedException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!