Click here to Skip to main content
15,896,118 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
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
Posted
Comments
Philippe Mori 16-Oct-15 12:22pm    
Uses hyperlink if you need a link.
Tell us the errors you get.
Show us the problematic code.

You will not get any usefull answer if you don't give enough information.

As mentionned in solution 1, if your question is related to an existing article, better to ask the question there.

By the way, is there any reason why you uses C++/CLI? Anyway for code like the one in the other article, it should not be hard to convert it or use it directly from another assembly in C#.

Please post your question in the forum at the end of the article.
 
Share this answer
 
It's a bad idea to rotate anything in PictireBox. 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 like Panel, in your overridden method OnPaint or a handler of the event OnPaint. 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 with System.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
 
Share this answer
 
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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900