HtmlTableRow.Align Proprietà
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Ottiene o imposta l'allineamento orizzontale del contenuto nelle celle di una riga in un HtmlTable controllo .
public:
property System::String ^ Align { System::String ^ get(); void set(System::String ^ value); };
public string Align { get; set; }
member this.Align : string with get, set
Public Property Align As String
Valore della proprietà
Allineamento orizzontale del contenuto nelle celle di una riga in un HtmlTable controllo . Il valore predefinito è Empty, che indica che questa proprietà non è impostata.
Esempio
Nell'esempio seguente viene illustrato come utilizzare la Align proprietà per controllare l'allineamento orizzontale del contenuto delle celle in un'intera riga.
<%@ Page Language="C#" AutoEventWireup="True" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
void Button_Click(Object sender, EventArgs e)
{
// Iterate through the rows of the table.
for (int i = 0; i <= Table1.Rows.Count - 1; i++)
{
// Update the properties of each row.
Table1.Rows[i].Align = AlignSelect.Value;
Table1.Rows[i].VAlign = VAlignSelect.Value;
}
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>HtmlTableRow Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>HtmlTableRow Example</h3>
<table id="Table1"
style="border-width:1; border-color:Black"
runat="server">
<tr>
<td>
Here is some content for Cell 1.
</td>
<td>
Here is some content for Cell 2.
</td>
</tr>
<tr>
<td style="width:100; height:100">
Here is some content for Cell 3.
</td>
<td style="width:100; height:100">
Here is some content for Cell 4.
</td>
</tr>
</table>
<hr />
Select the display settings for the cells in the table: <br /><br />
Align:
<select id="AlignSelect"
runat="server">
<option value="Left" selected="selected">Left</option>
<option value="Center">Center</option>
<option value="Right">Right</option>
</select>
VAlign:
<select id="VAlignSelect"
runat="server">
<option value="Top">Top</option>
<option value="Middle" selected="selected">Middle</option>
<option value="Bottom">Bottom</option>
</select>
<br /><br />
<input type="button"
value="Generate Table"
onserverclick="Button_Click"
runat="server"/>
</form>
</body>
</html>
<%@ Page Language="VB" AutoEventWireup="True" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Sub Button_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim i As Integer
' Iterate through the rows of the table.
For i = 0 To Table1.Rows.Count - 1
' Update the properties of each row.
Table1.Rows(i).Align = AlignSelect.Value
Table1.Rows(i).VAlign = VAlignSelect.Value
Next i
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>HtmlTableRow Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>HtmlTableRow Example</h3>
<table id="Table1"
style="border-width:1; border-color:Black"
runat="server">
<tr>
<td>
Here is some content for Cell 1.
</td>
<td>
Here is some content for Cell 2.
</td>
</tr>
<tr>
<td style="width:100; height:100">
Here is some content for Cell 3.
</td>
<td style="width:100; height:100">
Here is some content for Cell 4.
</td>
</tr>
</table>
<hr />
Select the display settings for the cells in the table: <br /><br />
Align:
<select id="AlignSelect"
runat="server">
<option value="Left" selected="selected">Left</option>
<option value="Center">Center</option>
<option value="Right">Right</option>
</select>
VAlign:
<select id="VAlignSelect"
runat="server">
<option value="Top">Top</option>
<option value="Middle" selected="selected">Middle</option>
<option value="Bottom">Bottom</option>
</select>
<br /><br />
<input type="button"
value="Generate Table"
onserverclick="Button_Click"
runat="server"/>
</form>
</body>
</html>
Commenti
Utilizzare la Align proprietà per specificare l'allineamento orizzontale del contenuto nelle celle di una riga in un HtmlTable controllo .
Annotazioni
L'impostazione di questa proprietà influisce su tutte le celle di una riga di una tabella rappresentata da un'istanza della HtmlTableRow classe . Per applicare un attributo di allineamento a una singola cella di una riga, impostare la Align proprietà per tale cella.
Nella tabella seguente sono elencati i valori che è possibile utilizzare per questa proprietà.
| Valore | Descrizione |
|---|---|
Left |
Allinea il contenuto della cella con il bordo sinistro della cella. |
Center |
Allinea il contenuto della cella al centro della cella. |
Right |
Allinea il contenuto della cella con il bordo destro della cella. |
Annotazioni
È anche possibile usare Justify e Char come valori per questa proprietà. Tuttavia, non tutti i browser supportano queste funzionalità.