Rotate Example VC++

This example shows several ways to orient an image, and then redisplay it.

void CImgEdit1Dlg::OnRotate() 
{
    // An example of some of the different ways an image could
    // be oriented.
   
    // This method displays a dialog box which allows
    // user to specify rotation by degrees.  Repaints
    // the screen automatically.  Rotate all writes the
    // file to disk.
    ImgEdit1.Rotate(TRUE); // rotate all pages
    ImgEdit1.Rotate(FALSE); // rotate current page
   
    // Autorefresh must be set to true or must call
    // Refresh after these methods.
    ImgEdit1.SetAutoRefresh(TRUE);
    VARIANT evt; V_VT(&evt) = VT_ERROR; // set to default
    ImgEdit1.RotateLeft(evt); // defaults to 90 degrees
    VARIANT vRotateAmt; V_VT(&vRotateAmt) = VT_I4; V_I4(&vRotateAmt) = 45;
    ImgEdit1.RotateRight(vRotateAmt); // optionally can specify degrees
    ImgEdit1.Flip(); // 180 degrees
    // You must save the image to maintain orientation.
}