GdPicture.NET.14
GdPicture14 Namespace / GdViewer Class / Rotate Method
A member of the RotateFlipType enumeration. Defines the required rotation and flipping.
Example





In This Topic
Rotate Method (GdViewer)
In This Topic
Rotates clockwise or flips the current page of the document displayed in the GdViewer control. The rotation angle can be set to 0, 90, 180 or 270 degrees clockwise and you are allowed to specify the axis used to flip the page.

The BeforeRotation event is raised just before the rotation process starts and the Rotation event is raised right after the rotation process finishes.

Be aware that the page is only rotated in the control, not in the document itself. Files are always handled as read-only in the GdViewer control.

Syntax
'Declaration
 
Public Function Rotate( _
   ByVal Rotation As RotateFlipType _
) As GdPictureStatus
public GdPictureStatus Rotate( 
   RotateFlipType Rotation
)
public function Rotate( 
    Rotation: RotateFlipType
): GdPictureStatus; 
public function Rotate( 
   Rotation : RotateFlipType
) : GdPictureStatus;
public: GdPictureStatus Rotate( 
   RotateFlipType Rotation
) 
public:
GdPictureStatus Rotate( 
   RotateFlipType Rotation
) 

Parameters

Rotation
A member of the RotateFlipType enumeration. Defines the required rotation and flipping.

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK. We strongly recommend always checking this status first.
Remarks
The BeforeRotation event is raised just before the rotation occurs and the Rotation event is raised right after the rotation finishes.

Please, be aware that displayed documents, specifically images, are always handled as read-only in the GdViewer control. If you want to manipulate with images in any way, for example to save the image after the page rotation, please use the GdPictureImaging class instead.

Example
How to rotate the current page upside down in the viewer.
'We assume that the GdViewer1 control has been properly integrated.
If GdViewer1.DisplayFromFile("") = GdPictureStatus.OK Then
    Dim rotation As RotateFlipType = RotateFlipType.Rotate180FlipNone
    If GdViewer1.Rotate(rotation) <> GdPictureStatus.OK Then
        MessageBox.Show("The current page can't be rotated. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.Rotate")
    End If
Else
    MessageBox.Show("The file can't be loaded. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.Rotate")
End If
//We assume that the GdViewer1 control has been properly integrated.
if (GdViewer1.DisplayFromFile("") == GdPictureStatus.OK)
{
    RotateFlipType rotation = RotateFlipType.Rotate180FlipNone;
    if (GdViewer1.Rotate(rotation) != GdPictureStatus.OK)
        MessageBox.Show("The current page can't be rotated. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.Rotate");
}
else
    MessageBox.Show("The file can't be loaded. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.Rotate");
See Also