1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Code showing How to rotate a dc 90 degrees...

Discussion in 'MFC' started by 燕山剑, Jun 1, 2007.

  1. 燕山剑

    燕山剑 New Member

    Joined:
    May 31, 2007
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    爱国者同盟 Chinese Patriot League
    Home Page:
    Code:
    XFORM x1form;
    XFORM xfform;
    XFORM x3form;
    
    //rotate the DC
    nGraphicsMode = SetGraphicsMode(dcDMJ.m_hDC, GM_ADVANCED);
    iAngle =1;
    
    
    
    double fangle = (double)90 / 180. * 3.1415926;
    x1form.eM11 = (float)cos(fangle);
    x1form.eM12 = (float)sin(fangle);
    x1form.eM21 = (float)-sin(fangle);
    x1form.eM22 = (float)cos(fangle);
    x1form.eDx = 0;
    x1form.eDy = 0;
    
    xfform.eM11 = 1;
    xfform.eM12 = 0;
    xfform.eM21 = 0;
    xfform.eM22 = 1;
    xfform.eDx = iepDlg->formExtproperties->m_nPageHeight;
    xfform.eDy = 0;
    
    CombineTransform(&x3form,&x1form,&xfform);
    ...
    
    if ( iAngle != 0 )
    {
        SetWorldTransform( dcDMJ.m_hDC,&x3form);
    }
    
    // restore the DC
    if ( iAngle != 0 )
    {
        x1form.eM11 = (float)1.0; 
        x1form.eM12 = (float)0;
        x1form.eM21 = (float)0;
        x1form.eM22 = (float)1.0;
        x1form.eDx = (float)0;
        x1form.eDy = (float)0;
    
        SetWorldTransform(dcDMJ.m_hDC, &x1form);
        SetGraphicsMode(dcDMJ.m_hDC, nGraphicsMode);
    }
     
  2. go4expert

    go4expert Moderator

    Joined:
    Aug 3, 2004
    Messages:
    306
    Likes Received:
    7
    Trophy Points:
    0
    I dont get what you are trying to say.
     

Share This Page