ContentDirection Enumeração
Definição
Representa a direção na qual exibir os controles que incluem texto em uma caixa de controles.Represents the direction in which to display controls that include text in a container control.
public enum class ContentDirection
public enum ContentDirection
type ContentDirection =
Public Enum ContentDirection
- Herança
Campos
| LeftToRight | 1 | Da esquerda para a direita.Left to right. |
| NotSet | 0 | Não definida.Not set. |
| RightToLeft | 2 | Da direita para a esquerda.Right to left. |
Exemplos
O exemplo a seguir demonstra como usar a ContentDirection enumeração para definir a Panel.Direction propriedade.The following example demonstrates how to use the ContentDirection enumeration to set the Panel.Direction property. Um ListBox controle é populado com os ContentDirection valores de enumeração.A ListBox control is populated with the ContentDirection enumeration values. A direção de exibição do rótulo e dos botões de opção no painel muda com base no valor que o usuário seleciona na caixa de listagem.The display direction of the label and radio buttons in the panel change based on the value that the user selects from the list box. Como este exemplo usa texto em inglês, quando o RightToLeft valor é selecionado, o texto é justificado no lado direito do Panel controle, mas a ordem da esquerda para a direita do texto em inglês é mantida.Because this example uses English text, when the RightToLeft value is selected, the text is justified on the right side of the Panel control, but the left-to-right order of the English text is maintained. Em um aplicativo do mundo real, você não definiria a Panel.Direction propriedade como o RightToLeft valor, se você estivesse exibindo texto para um idioma que usa a ordem da esquerda para a direita.In a real-world application, you would not set the Panel.Direction property to the RightToLeft value, if you were displaying text for a language that uses left-to-right order.
<%@ 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>Panel.Direction Property Example</title>
<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>
Comentários
A ContentDirection enumeração representa a direção na qual exibir controles que incluem texto em um controle de contêiner.The ContentDirection enumeration represents the direction in which to display controls that include text in a container control. Controles como os Panel controles e WebPart têm propriedades que usam os ContentDirection valores de enumeração para especificar a direção na qual exibir controles filho que incluem texto.Controls such as the Panel and WebPart controls have properties that use the ContentDirection enumeration values to specify the direction in which to display child controls that include text.
Se você especificar o LeftToRight valor, os controles filho que incluem texto de exibição de textos da esquerda para a direita e justificarão o texto no lado esquerdo do controle de contêiner.If you specify the LeftToRight value, child controls that include text display text from left to right and justify the text on the left side of the container control. Se você especificar o RightToLeft valor, os controles filho que incluam texto exibem texto da direita para a esquerda e justificam o texto no lado direito do controle de contêiner.If you specify the RightToLeft value, child controls that include text display text from right to left and justify the text on the right side of the container control. Use o RightToLeft valor para exibir texto para idiomas que são gravados da direita para a esquerda, como árabe e Hebraico.Use the RightToLeft value to display text for languages that are written from right to left, such as Arabic and Hebrew.