次の方法で共有


RadioButtonList.TextAlign プロパティ

グループ内のオプション ボタンのテキストの配置を取得または設定します。

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)

構文

'宣言
Public Overridable Property TextAlign As TextAlign
'使用
Dim instance As RadioButtonList
Dim value As TextAlign

value = instance.TextAlign

instance.TextAlign = value
public virtual TextAlign TextAlign { get; set; }
public:
virtual property TextAlign TextAlign {
    TextAlign get ();
    void set (TextAlign value);
}
/** @property */
public TextAlign get_TextAlign ()

/** @property */
public void set_TextAlign (TextAlign value)
public function get TextAlign () : TextAlign

public function set TextAlign (value : TextAlign)
適用できません。

プロパティ値

TextAlign 値の 1 つ。既定値は Right です。

例外

例外の種類 条件

ArgumentOutOfRangeException

オプション ボタンに関連付けられるラベル テキストの配置は、TextAlign 値ではありません。

解説

このプロパティを使用して、オプション ボタンに関連付けられたテキストを左右のどちらに表示するかを指定します。このプロパティを TextAlign.Right に設定すると、テキストはオプション ボタンの右に表示されます。このプロパティを TextAlign.Left に設定すると、テキストはオプション ボタンの左に表示されます。

使用例

TextAlign プロパティを使用して、オプション ボタンに関連付けられたテキストを RadioButtonList コントロールの左側に表示する方法を次のコード例に示します。

<%@ Page Language="C#" AutoEventWireup="True" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>RadioButtonList.TextAlign Example</title>
</head>
<body>

<asp:RadioButtonList id="RadioButtonList1"
      RepeatColumns = "2" 
      RepeatDirection="Vertical" 
      RepeatLayout="Table"  
      TextAlign="Left"  
      runat="server">
 
    <asp:ListItem>Item 1</asp:ListItem>
    <asp:ListItem>Item 2</asp:ListItem>
    <asp:ListItem>Item 3</asp:ListItem>
    <asp:ListItem>Item 4</asp:ListItem>
    <asp:ListItem>Item 5</asp:ListItem>
    <asp:ListItem>Item 6</asp:ListItem>
 
 </asp:RadioButtonList>
</body>
</html>   
<%@ Page Language="JScript" AutoEventWireup="True" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>RadioButtonList.TextAlign Example</title>
</head>
<body>

<asp:RadioButtonList id="RadioButtonList1"
      RepeatColumns = "2" 
      RepeatDirection="Vertical" 
      RepeatLayout="Table"  
      TextAlign="Left"  
      runat="server">
 
    <asp:ListItem>Item 1</asp:ListItem>
    <asp:ListItem>Item 2</asp:ListItem>
    <asp:ListItem>Item 3</asp:ListItem>
    <asp:ListItem>Item 4</asp:ListItem>
    <asp:ListItem>Item 5</asp:ListItem>
    <asp:ListItem>Item 6</asp:ListItem>
 
 </asp:RadioButtonList>
</body>
</html>   

プラットフォーム

Windows 98,Windows Server 2000 SP4,Windows CE,Windows Millennium Edition,Windows Mobile for Pocket PC,Windows Mobile for Smartphone,Windows Server 2003,Windows XP Media Center Edition,Windows XP Professional x64 Edition,Windows XP SP2,Windows XP Starter Edition

Microsoft .NET Framework 3.0 は Windows Vista,Microsoft Windows XP SP2,および Windows Server 2003 SP1 でサポートされています。

バージョン情報

.NET Framework

サポート対象 : 3.0,2.0,1.1,1.0

参照

関連項目

RadioButtonList クラス
RadioButtonList メンバ
System.Web.UI.WebControls 名前空間
TextAlign

その他の技術情報

RadioButton Web サーバー コントロールおよび RadioButtonList Web サーバー コントロール