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

Dim instance As Panel Dim value As ContentDirection value = instance.Direction instance.Direction = value
public: virtual property ContentDirection Direction { ContentDirection get (); void set (ContentDirection value); }
/** @property */ public ContentDirection get_Direction () /** @property */ public void set_Direction (ContentDirection value)
public function get Direction () : ContentDirection public function set Direction (value : ContentDirection)
ContentDirection 列挙値の 1 つ。既定値は NotSet です。

Direction プロパティを使用して、テキストを含むコントロールを Panel コントロールに表示する方向を指定します。このプロパティは、ContentDirection 列挙値の 1 つを使用して設定します。有効値の一覧を次の表に示します。
LeftToRight を指定した場合、テキストが含まれる子コントロールが左から右に表示されます。RightToLeft を指定した場合、テキストが含まれる子コントロールが右から左に表示されます。RightToLeft は、アラビア語やヘブライ語など、右から左に記述する言語のテキストを表示する場合に使用します。

Direction プロパティをプログラムによって設定する方法のコード例を次に示します。ListBox コントロールには、ContentDirection 列挙値が設定されます。パネル内でのラベルおよびオプション ボタンの表示方向は、ユーザーがリスト ボックスから選択する値によって変わります。この例では英文テキストを使用しています。このため RightToLeft 値が選択されると、テキストは Panel コントロールの右側に合わせて表示されますが、英文テキストの左から右への方向は保持されます。実際に使用するアプリケーションでは、左から右に記述する言語のテキストを表示する場合は、Direction プロパティを RightToLeft に設定しません。
![]() |
---|
次のコード サンプルはシングルファイル コード モデルを使用しており、分離コード ファイルに直接コピーされた場合は正常に動作しない可能性があります。このコード サンプルは、拡張子が .aspx の空のテキスト ファイルにコピーする必要があります。Web フォームのコード モデルの詳細については、「ASP.NET Web ページのコード モデル」を参照してください。 |
<%@ Page Language="VB" %> <html> <head> <script runat="server"> Sub ListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) ' Determine which list item was clicked. ' Change the display direction of content in the panel. Select Case (ListBox1.SelectedIndex) Case 0 Panel1.Direction = ContentDirection.NotSet Case 1 Panel1.Direction = ContentDirection.LeftToRight Case 2 Panel1.Direction = ContentDirection.RightToLeft Case Else Throw New Exception("You did not select a valid list item.") End Select End Sub </script> </head> <body> <form ID="Form1" runat="server"> <h3>Panel.Direction Property Example</h3> <h4>Select the content display direction for the controls in the panel.</h4> <asp:ListBox ID="ListBox1" Rows=3 AutoPostBack=True SelectionMode=Single OnSelectedIndexChanged="ListBox1_SelectedIndexChanged" runat=Server> <asp:ListItem>NotSet</asp:ListItem> <asp:ListItem>LeftToRight</asp:ListItem> <asp:ListItem>RightToLeft</asp:ListItem> </asp:ListBox> <hr /> <asp:Panel ID="Panel1" Height="100px" Width="300px" BackColor=Aqua runat=Server> <asp:Label ID="Label1" Text = "Select a programming language" runat=Server> </asp:Label><br><br> <asp:RadioButton id="Radio1" Text="C#" Checked="False" GroupName="RadioGroup1" runat="server"> </asp:RadioButton><br> <asp:RadioButton id="Radio2" Text="Visual Basic" Checked="False" GroupName="RadioGroup1" runat="server"> </asp:RadioButton><br> <asp:RadioButton id="Radio3" Text="C++" Checked="False" GroupName="RadioGroup1" runat="server"> </asp:RadioButton><br> </asp:Panel> </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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からPanel.Direction プロパティを検索する場合は、下記のリンクをクリックしてください。

- Panel.Direction プロパティのページへのリンク