Click here to Skip to main content
15,920,603 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to rotate an icon? Pin
eli1502197928-Jul-07 8:06
eli1502197928-Jul-07 8:06 
GeneralRe: How to rotate an icon? Pin
Randor 28-Jul-07 8:09
professional Randor 28-Jul-07 8:09 
GeneralRe: How to rotate an icon? Pin
eli1502197928-Jul-07 8:14
eli1502197928-Jul-07 8:14 
GeneralRe: How to rotate an icon? Pin
Randor 28-Jul-07 8:45
professional Randor 28-Jul-07 8:45 
GeneralRe: How to rotate an icon? Pin
eli1502197928-Jul-07 8:54
eli1502197928-Jul-07 8:54 
GeneralRe: How to rotate an icon? Pin
Mark Salsbery28-Jul-07 8:15
Mark Salsbery28-Jul-07 8:15 
GeneralRe: How to rotate an icon? Pin
eli1502197928-Jul-07 8:29
eli1502197928-Jul-07 8:29 
GeneralRe: How to rotate an icon? Pin
Mark Salsbery30-Jul-07 6:55
Mark Salsbery30-Jul-07 6:55 
You probably have your solution by now, but just to provide another option, here's GDI+ code
that rotates an icon (in a window) around its center point, 360 degrees at 0.5 degree intervals:

    // Note - this assumes icon is 96x96 - use the appropriate dimensions when loading the icon with LoadImage()
 
    HICON hIcon = (HICON)::LoadImage(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDI_MYICON), IMAGE_ICON, 96, 96, 0);
    Gdiplus::Bitmap SrcBitmap(hIcon);

    Graphics DstGraphics(*this); // "*this" is the destination HWND 
    REAL angle = 0.0f;
    for (int i = 0; i < 720; ++i)
    {
        DstGraphics.ResetTransform();
        DstGraphics.RotateTransform(angle);
        DstGraphics.TranslateTransform(SrcBitmap.GetWidth()/2.0f, SrcBitmap.GetWidth()/2.0f, MatrixOrderAppend);
        DstGraphics.DrawImage(&SrcBitmap, -((INT)SrcBitmap.GetWidth()/2), -((INT)SrcBitmap.GetHeight()/2), SrcBitmap.GetWidth(), SrcBitmap.GetHeight());

        angle += 0.5f;
    }
Mark



Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

AnswerRe: How to rotate an icon? Pin
Randor 28-Jul-07 7:07
professional Randor 28-Jul-07 7:07 
GeneralRe: How to rotate an icon? Pin
Randor 28-Jul-07 7:12
professional Randor 28-Jul-07 7:12 
GeneralRe: How to rotate an icon? Pin
GepardHH30-Jul-07 0:52
GepardHH30-Jul-07 0:52 
Questioninvoking C# function from C++ Pin
George_George28-Jul-07 2:26
George_George28-Jul-07 2:26 
AnswerRe: invoking C# function from C++ [Edit] Pin
Eytukan28-Jul-07 3:31
Eytukan28-Jul-07 3:31 
GeneralRe: invoking C# function from C++ [Edit] Pin
George_George30-Jul-07 20:34
George_George30-Jul-07 20:34 
GeneralRe: invoking C# function from C++ [Edit] Pin
Eytukan30-Jul-07 20:59
Eytukan30-Jul-07 20:59 
GeneralRe: invoking C# function from C++ [Edit] Pin
George_George31-Jul-07 14:58
George_George31-Jul-07 14:58 
QuestionReading WAV files into IStream Pin
Anorexic Tribble28-Jul-07 2:25
Anorexic Tribble28-Jul-07 2:25 
AnswerRe: Reading WAV files into IStream Pin
Roger Broomfield28-Jul-07 3:07
Roger Broomfield28-Jul-07 3:07 
GeneralRe: Reading WAV files into IStream Pin
Anorexic Tribble28-Jul-07 4:24
Anorexic Tribble28-Jul-07 4:24 
QuestionWanted - "Command prompt" type component Pin
Robin Hilliard28-Jul-07 1:52
Robin Hilliard28-Jul-07 1:52 
AnswerRe: Wanted - "Command prompt" type component Pin
Hans Dietrich28-Jul-07 18:16
mentorHans Dietrich28-Jul-07 18:16 
Questiondraw image on glass in windows vista? Pin
pankaj garg iitd27-Jul-07 21:32
pankaj garg iitd27-Jul-07 21:32 
QuestionCListCtrl Pin
Kiran Pinjala27-Jul-07 21:11
Kiran Pinjala27-Jul-07 21:11 
AnswerRe: CListCtrl Pin
Don Box27-Jul-07 23:31
Don Box27-Jul-07 23:31 
AnswerRe: CListCtrl Pin
Michael Dunn28-Jul-07 9:32
sitebuilderMichael Dunn28-Jul-07 9:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.