如何在cpp / cli上的图片框中旋转图像 [英] How to rotatie image in a picturebox on cpp/cli
本文介绍了如何在cpp / cli上的图片框中旋转图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好我是c ++ / cli的初学者,我想制作一个旋转图像的程序,我在c#中看到一个例子,我想在cpp / cli上编程
但是我的程序中有错误,你能帮我吗
例如#http://www.codeproject.com/Articles/58815/C -Image-PictureBox-Rotations
谢谢
Hello i'm a beginer on c++/cli, i want to make a program that rotate an image in a picturboxe, i see an exemple in c#, i want to program it on cpp/cli
but i had errors in my programe, can you help me please
the exemplei n c# http://www.codeproject.com/Articles/58815/C-Image-PictureBox-Rotations
Thanks
推荐答案
请在论坛结束时发表您的问题这篇文章。
Please post your question in the forum at the end of the article.
在PictireBox
中旋转任何东西都是个坏主意。你需要旋转图像,而不是控制,这根本不会帮助你,只会增加麻烦并浪费一些资源而不给予任何回报。相反,在您的重写方法OnPaint $ c中直接在控件中渲染图像,该控件可以是自定义控件,甚至是
Panel
。 $ c>或事件的处理程序OnPaint
。PictireBox
实际上也是如此,只是没有你对它的直接控制。有关详细信息,请参阅我过去的答案:
在图片框中附加图片 [ ^ ],
如何从旧图纸中清除面板 [ ^ ],
在C#中绘制一个矩形 [ ^ ],
如何避免在DatagridView C#中使用红十字[ [^ ],
什么样的俏皮方法是Paint? (DataGridViewImageCell.Paint(...)) [ ^ ],
在面板上捕获绘图 [ ^ ],
mdi子表单之间的绘制线 [ ^ ],
如何加快我的vb.net应用程序? [ ^ ]。
请注意表格图形System.Drawing
基于立即模式,而不是保留模式:
https://en.wikipedia.org/wiki/Retained_mode [ ^ ],
https://en.wikipedia.org/wiki/Immediate_mode_%28computer_graphics%29 [ ^ ]。
现在,关于轮换:这是你可以使用的:
https:// msdn。 microsoft.com/en-us/library/system.drawing.graphics.transform%28v=vs.110%29.aspx [< a href =https://msdn.microsoft.com/en-us/library/system.drawing.graphics.transform%28v=vs.110%29.aspxtarget =_ blanktitle =New Window> ^ ],
https://msdn.microsoft.com/en-us/library/system.drawing.drawing2d.matrix(v = vs.110).aspx [ ^ ],
https: //msdn.microsoft.com/en-us/library/system.drawing.drawing2d.matrix.rotate%28v=vs.110%29.aspx [ ^ ],
https: //msdn.mi crosoft.com/en-us/library/system.drawing.drawing2d.matrix.rotateat%28v=vs.110%29.aspx [ ^ ]。
轻松,不是吗?
-SA
It's a bad idea to rotate anything inPictireBox
. You need to rotate image, not control, which won't help you at all, will only add hassles and waste some resources giving nothing in return. Instead, render the image directly in your control, which could be a custom control or even something likePanel
, in your overridden methodOnPaint
or a handler of the eventOnPaint
.PictireBox
actually does the same, only without your direct control over it. For further detail, please see my past answers:
Append a picture within picturebox[^],
How do I clear a panel from old drawing[^],
draw a rectangle in C#[^],
How to avoid Red Cross in DatagridView C#[^],
What kind of playful method is Paint? (DataGridViewImageCell.Paint(...))[^],
capture the drawing on a panel[^],
Drawing Lines between mdi child forms[^],
How to speed up my vb.net application?[^].
Note that Forms graphics withSystem.Drawing
is based on immediate mode, not retained mode:
https://en.wikipedia.org/wiki/Retained_mode[^],
https://en.wikipedia.org/wiki/Immediate_mode_%28computer_graphics%29[^].
Now, as to the rotation: this is what you can use:
https://msdn.microsoft.com/en-us/library/system.drawing.graphics.transform%28v=vs.110%29.aspx[^],
https://msdn.microsoft.com/en-us/library/system.drawing.drawing2d.matrix(v=vs.110).aspx[^],
https://msdn.microsoft.com/en-us/library/system.drawing.drawing2d.matrix.rotate%28v=vs.110%29.aspx[^],
https://msdn.microsoft.com/en-us/library/system.drawing.drawing2d.matrix.rotateat%28v=vs.110%29.aspx[^].
Easy, isn't it?
—SA
感谢您的重播,但我想用C ++ / CLI编程而不是c#:)
你可以让我成为一个应用程序,用c ++ / cli将图像从180转到-180
请
Thanks for your replay, but me i want to program that in C++/CLI not in c# :)
could you make me an applicatio, with c++/cli that rotate an image from 180 to -180
Please
这篇关于如何在cpp / cli上的图片框中旋转图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文