LEADTOOLS WinRT(Leadtools.Controls)
LEAD Technologies, Inc

ImageHorizontalAlignment Property

Example 

Gets or sets a value that indicates the horizontal alignment for the image in this control. WinRT support
Syntax
public ControlAlignment ImageHorizontalAlignment {get; set;}
 get_ImageHorizontalAlignment();
set_ImageHorizontalAlignment(value);

Property Value

The horizontal alignment for the image in this control. Default value is ControlAlignment.Near (left).
Remarks

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

Use ImageVerticalAlignment to set the vertical alignment for the image in the control.

Example
Copy CodeCopy Code  
[TestMethod]
public void ImageHorizontalAlignmentExample()
{
   // Loop through the image horizontal and vertical alignments
   ControlAlignment horizontalAlignment = _viewer.ImageHorizontalAlignment;
   ControlAlignment verticalAlignment = _viewer.ImageVerticalAlignment;
   if(horizontalAlignment == ControlAlignment.Near)
      horizontalAlignment = ControlAlignment.Center;
   else if(horizontalAlignment == ControlAlignment.Center)
      horizontalAlignment = ControlAlignment.Far;
   else if(horizontalAlignment == ControlAlignment.Far)
      horizontalAlignment = ControlAlignment.Near;

   if(verticalAlignment == ControlAlignment.Near)
      verticalAlignment = ControlAlignment.Center;
   else if(verticalAlignment == ControlAlignment.Center)
      verticalAlignment = ControlAlignment.Far;
   else if(verticalAlignment == ControlAlignment.Far)
      verticalAlignment = ControlAlignment.Near;

   // Show the values in the label
   string[] controlAlignmentNames = { "Near", "Center", "Far" };

   _infoLabel.Text = controlAlignmentNames[(int)horizontalAlignment] + " and " + controlAlignmentNames[(int)verticalAlignment];

   // Set the new values in _viewer
   _viewer.ImageHorizontalAlignment = horizontalAlignment;
   _viewer.ImageVerticalAlignment = verticalAlignment;
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

ImageViewer Class
ImageViewer Members

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.