LEADTOOLS JavaScript (Leadtools.Controls)
LEAD Technologies, Inc

ImageHorizontalAlignment Property

Example 

Gets or sets a value that indicates the horizontal alignment for the image in this control.
Syntax
  get_imageHorizontalAlignment();
 set_imageHorizontalAlignment(value);
!MISSING Scrap '_RTJavaScript_PROPERTY_SYNTAX'!

Property Value

TypeDescription
ControlAlignmentThe 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

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:

Open the HTML page in your browser, now when you click the Example button, the horizontal and vertical alignment values will change.

  • JavaScript
  •   
     
    example: function SiteLibrary_DefaultPage$example(viewer) {
       // Loop through the image horizontal and vertical alignments
       var horizontalAlignment = viewer.get_imageHorizontalAlignment();
       var verticalAlignment = viewer.get_imageVerticalAlignment();
    
       if(horizontalAlignment == Leadtools.Controls.ControlAlignment.near)
          horizontalAlignment = Leadtools.Controls.ControlAlignment.center;
       else if(horizontalAlignment == Leadtools.Controls.ControlAlignment.center)
          horizontalAlignment = Leadtools.Controls.ControlAlignment.far;
       else if(horizontalAlignment == Leadtools.Controls.ControlAlignment.far)
          horizontalAlignment = Leadtools.Controls.ControlAlignment.near;
    
       if(verticalAlignment == Leadtools.Controls.ControlAlignment.near)
          verticalAlignment = Leadtools.Controls.ControlAlignment.center;
       else if(verticalAlignment == Leadtools.Controls.ControlAlignment.center)
          verticalAlignment = Leadtools.Controls.ControlAlignment.far;
       else if(verticalAlignment == Leadtools.Controls.ControlAlignment.far)
          verticalAlignment = Leadtools.Controls.ControlAlignment.near;
    
       // Show the values in the label
       var controlAlignmentNames = [ "Near", "Center", "Far" ];
    
       var exampleLabel = document.getElementById("exampleLabel");
       exampleLabel.textContent = controlAlignmentNames[horizontalAlignment] + " and " + controlAlignmentNames[verticalAlignment];
    
       // Set the new values in viewer
       viewer.set_imageHorizontalAlignment(horizontalAlignment);
       viewer.set_imageVerticalAlignment(verticalAlignment);
    },
See Also

Reference

ImageViewer Object
ImageViewer Members

 

 


Products | Support | Contact Us | Copyright Notices

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