CheckBox.TextAlign プロパティ
アセンブリ: System.Web (system.web.dll 内)

Dim instance As CheckBox Dim value As TextAlign value = instance.TextAlign instance.TextAlign = value
/** @property */ public TextAlign get_TextAlign () /** @property */ public void set_TextAlign (TextAlign value)
TextAlign 値の 1 つ。既定値は Right です。


このプロパティを使用して、CheckBox コントロールに関連付けられるテキスト ラベルの配置を指定します。テキスト ラベルをチェック ボックスの右側に表示するか、左側に表示するかを指定できます。ラベル テキストを指定するには、Text プロパティを使用します。

TextAlign プロパティを使用して、テキスト ラベルをチェック ボックスの右側に表示する方法を次の例に示します。
![]() |
---|
次のコード サンプルはシングルファイル コード モデルを使用しており、分離コード ファイルに直接コピーされた場合は正常に動作しない可能性があります。このコード サンプルは、拡張子が .aspx の空のテキスト ファイルにコピーする必要があります。Web フォームのコード モデルの詳細については、「ASP.NET Web ページのコード モデル」を参照してください。 |
<%@ Page Language="VB" AutoEventWireup="True" %> <html> <head> <script runat="server"> Sub Check_Clicked(sender As Object, e As EventArgs) ' Calculate the subtotal and display the result in currency format. ' Include tax if the check box is selected. Message.Text = CalculateTotal(checkbox1.Checked).ToString("c") End Sub Sub Page_Load(sender As Object, e As EventArgs) ' Display the subtotal without tax when the page is first loaded. If Not IsPostBack Then ' Calculate the subtotal and display the result in currency format. Message.Text = CalculateTotal(false).ToString("c") End If End Sub Function CalculateTotal(Taxable As Boolean) As Double ' Calculate the subtotal for the example. Dim Result As Double = 1.99 + 2.99 + 3.99 ' Add tax, if applicable. If(Taxable) Result += Result * 0.086 End If Return Result End Function </script> </head> <body> <form runat="server"> <h3>CheckBox CheckedChanged Example</h3> Select whether to include tax in the subtotal. <br><br> <table border="1" cellpadding="5"> <tr> <th colspan="2"> Shopping cart </th> </tr> <tr> <td> Item 1 </td> <td> $1.99 </td> </tr> <tr> <td> Item 2 </td> <td> $2.99 </td> </tr> <tr> <td> Item 3 </td> <td> $3.99 </td> </tr> <tr> <td> <b>Subtotal</b> </td> <td> <asp:Label id="Message" runat="server"/> </td> </tr> <tr> <td colspan="2"> <asp:CheckBox id="checkbox1" runat="server" AutoPostBack="True" Text="Include 8.6% sales tax" TextAlign="Right" OnCheckedChanged="Check_Clicked"/> </td> </tr> </table> </form> </body> </html>
<%@ Page Language="C#" AutoEventWireup="True" %> <html> <head> <script runat="server"> void Check_Clicked(Object sender, EventArgs e) { // Calculate the subtotal and display the result in currency format. // Include tax if the check box is selected. Message.Text = CalculateTotal(checkbox1.Checked).ToString("c"); } void Page_Load(Object sender, EventArgs e) { // Display the subtotal without tax when the page is first loaded. if(!IsPostBack) { // Calculate the subtotal and display the result in currency format. Message.Text = CalculateTotal(false).ToString("c"); } } double CalculateTotal(bool Taxable) { // Calculate the subtotal for the example. double Result = 1.99 + 2.99 + 3.99; // Add tax, if applicable. if(Taxable) { Result += Result * 0.086; } return Result; } </script> </head> <body> <form runat="server"> <h3>CheckBox CheckedChanged Example</h3> Select whether to include tax in the subtotal. <br><br> <table border="1" cellpadding="5"> <tr> <th colspan="2"> Shopping cart </th> </tr> <tr> <td> Item 1 </td> <td> $1.99 </td> </tr> <tr> <td> Item 2 </td> <td> $2.99 </td> </tr> <tr> <td> Item 3 </td> <td> $3.99 </td> </tr> <tr> <td> <b>Subtotal</b> </td> <td> <asp:Label id="Message" runat="server"/> </td> </tr> <tr> <td colspan="2"> <asp:CheckBox id="checkbox1" runat="server" AutoPostBack="True" Text="Include 8.6% sales tax" TextAlign="Right" OnCheckedChanged="Check_Clicked"/> </td> </tr> </table> </form> </body> </html>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


CheckBox.TextAlign プロパティ
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

Dim instance As CheckBox Dim value As ContentAlignment value = instance.TextAlign instance.TextAlign = value
[LocalizableAttribute(true)] public: virtual property ContentAlignment TextAlign { ContentAlignment get () override; void set (ContentAlignment value) override; }
/** @property */ public ContentAlignment get_TextAlign () /** @property */ public void set_TextAlign (ContentAlignment value)
public override function get TextAlign () : ContentAlignment public override function set TextAlign (value : ContentAlignment)
ContentAlignment 値の 1 つ。既定値は MiddleLeft です。

Windows 98, Windows 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
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からCheckBox.TextAlignを検索する場合は、下記のリンクをクリックしてください。

- CheckBox.TextAlignのページへのリンク