Export (0) Print
Expand All

Image.ImageAlign Property

Gets or sets the alignment of the Image control in relation to other elements on the Web page.

[Visual Basic]
Public Overridable Property ImageAlign As ImageAlign
[C#]
public virtual ImageAlign ImageAlign {get; set;}
[C++]
public: __property virtual ImageAlign get_ImageAlign();
public: __property virtual void set_ImageAlign(ImageAlign);
[JScript]
public function get ImageAlign() : ImageAlign;
public function set ImageAlign(ImageAlign);

Property Value

One of the ImageAlign values. The default is NotSet.

Exceptions

Exception Type Condition
ArgumentException The specified value is not one of the ImageAlign values.

Remarks

Use the ImageAlign property to specify or determine the alignment of the image in relation to other elements on the Web page. The following table lists the possible alignments.

Alignment Description
NotSet The alignment is not set.
Left The image is aligned on the left edge of the Web page with text wrapping on the right.
Right The image is aligned on the right edge of the Web page with text wrapping on the left.
Baseline The lower edge of the image is aligned with the lower edge of the first line of text.
Top The upper edge of the image is aligned with the upper edge of the highest element on the same line.
Middle The middle of the image is aligned with the lower edge of the first line of text.
Bottom The lower edge of the image is aligned with the lower edge of the first line of text.
AbsBottom The lower edge of the image is aligned with the lower edge of the largest element on the same line.
AbsMiddle The middle of the image is aligned with the middle of the largest element on the same line.
TextTop The upper edge of the image is aligned with the upper edge of the highest text on the same line.

Example

[Visual Basic, C#, JScript] The following example demonstrates how to use the ImageAlign property to specify the alignment of the Image control in relation to other elements on the Web page.

[Visual Basic] 
<%@ Page Language="VB" %>
<html>
<head>

</head>
 
<body>

   <form runat="server">

      <h3>Image Example</h3>

      <asp:Image id="Image1" runat="server"
           AlternateText="Image Text"
           ImageAlign="left"
           ImageUrl="images/image1.jpg"/>
  
   </form>

</body>
</html>


[C#] 
<%@ Page Language="C#" %>
<html>
<head>

</head>
 
<body>

   <form runat="server">

      <h3>Image Example</h3>

      <asp:Image id="Image1" runat="server"
           AlternateText="Image Text"
           ImageAlign="left"
           ImageUrl="images/image1.jpg"/>
  
   </form>

</body>
</html>


[JScript] 
<%@ Page Language="JSCRIPT" %>
<html>
<head>

</head>
 
<body>

   <form runat="server">

      <h3>Image Example</h3>

      <asp:Image id="Image1" runat="server"
           AlternateText="Image Text"
           ImageAlign="left"
           ImageUrl="images/image1.jpg"/>
  
   </form>

</body>
</html>

[C++] No example is available for C++. To view a Visual Basic, C#, or JScript example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

Image Class | Image Members | System.Web.UI.WebControls Namespace | ImageAlign

Show:
© 2014 Microsoft