Image.ImageAlign 屬性

定義

取得或設定 Image 控制項相對於 Web 網頁上其他項目的對齊方式。Gets or sets the alignment of the Image control in relation to other elements on the Web page.

public:
 virtual property System::Web::UI::WebControls::ImageAlign ImageAlign { System::Web::UI::WebControls::ImageAlign get(); void set(System::Web::UI::WebControls::ImageAlign value); };
[System.ComponentModel.Bindable(true)]
public virtual System.Web.UI.WebControls.ImageAlign ImageAlign { get; set; }
public virtual System.Web.UI.WebControls.ImageAlign ImageAlign { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.ImageAlign : System.Web.UI.WebControls.ImageAlign with get, set
member this.ImageAlign : System.Web.UI.WebControls.ImageAlign with get, set
Public Overridable Property ImageAlign As ImageAlign

屬性值

ImageAlign

其中一個 ImageAlign 值。One of the ImageAlign values. 預設為 NotSetThe default is NotSet.

屬性

例外狀況

指定的值不是其中一個 ImageAlign 值。The specified value is not one of the ImageAlign values.

範例

下列範例示範如何使用 ImageAlign 屬性來指定 Image 控制項相對於網頁上其他元素的對齊方式。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.

<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Image Example</title>
</head>
 
<body>

   <form id="form1" runat="server">

      <h3>Image Example</h3>

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

</body>
</html>

<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Image Example</title>
</head>
 
<body>

   <form id="form1" runat="server">

      <h3>Image Example</h3>

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

</body>
</html>

備註

ImageAlign 可以使用屬性來指定或判斷影像相對於網頁上其他元素的對齊方式。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 影像在 Web 網頁的左邊緣對齊而文字在右邊換行。The image is aligned on the left edge of the Web page with text wrapping on the right.
Right 影像在 Web 網頁的右邊緣對齊而文字在左邊換行。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.

適用於

另請參閱