←Select platform

RotateAngle Property

Summary

Value of the rotation angle to use when displaying the view.

Syntax
C#
VB
C++
public virtual double RotateAngle { get; set; } 
Public Overridable Property RotateAngle() As Double 
   Get 
   Set 
public:  
   virtual property double RotateAngle 
   { 
      double get() 
      void set(double value) 
   } 

Property Value

The rotation angle for the image display, in degrees. The default value is 0.

Remarks

Changing the value of this property will fire the PropertyChanged and TransformChanged events.

This is a display value and the image data will not be changed. Only the value of ViewTransform.

Rotating the view is similar to rotating a rectangle, the values of "width" and "height" might change. When you rotate the view using the RotateAngle property, the ResizeOnTransform property determines whether the viewer should change the size of the scrolling area as well. For example, if you have an view (image) that is 100 by 200 pixels and you rotate it by 90 degrees clock wise, the new view size should be 200 by 100 pixels. If ResizeOnTransform was set to true (the default value), then the viewer will rotate the image around 0,0 and translate it to come up with a transformation that will show the image in this position. The new scroll area will be adjusted according to the image's new size (200, 100).

If the value of ResizeOnTransform is set to false, then the image will be rotated around its center and no sizing will be performed and parts of the image might be end up outside the visible area.

Setting this value will automatically update ImageViewerItem.RotateAngle of all the items in this viewer to the same value. To change an item value individually, use the item property directly.

For more information, refer to Image Viewer Appearance.

Example

Run the demo. Now when you click the Example button, the image will rotate and the value of ResizeOnTransform will be flipped. Notice that when ResizeOnTransform is true, you can use the scrollbars to viewer the whole new image size. When the value is false, the image is rotated around its center and you might not be able to view the whole area

Start with the ImageViewer example, remove all the code inside the example function (search for the "// TODO: add example code here" comment) and insert the following code:

C#
VB
using Leadtools; 
using Leadtools.Controls; 
using Leadtools.Codecs; 
using Leadtools.Drawing; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Color; 
 
 
public void ImageViewerRotateAngle_Example() 
{ 
   MessageBox.Show("Current _imageViewer.RotateAngle is " + _imageViewer.RotateAngle); 
   // Rotate the viewer to 90 degree 
   _imageViewer.RotateAngle = 90; 
 
} 
Imports Leadtools 
Imports Leadtools.Controls 
Imports Leadtools.Codecs 
Imports Leadtools.Drawing 
Imports Leadtools.ImageProcessing 
Imports Leadtools.ImageProcessing.Color 
Imports LeadtoolsControlsExamples.LeadtoolsExamples.Common 
 
Public Sub ImageViewerRotateAngle_Example() 
 
   MessageBox.Show("Current _imageViewer.RotateAngle is " & _imageViewer.RotateAngle) 
   ' Rotate the viewer to 90 degree 
   _imageViewer.RotateAngle = 90 
End Sub 
Requirements
Target Platforms
Help Version 21.0.2021.7.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Controls Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.