Share via


RadioButtonList.CellPadding 屬性

定義

取得或設定表格儲存格的框線與內容之間的距離 (以像素為單位)。

public:
 virtual property int CellPadding { int get(); void set(int value); };
[System.ComponentModel.Bindable(true)]
public virtual int CellPadding { get; set; }
public virtual int CellPadding { get; set; }
[<System.ComponentModel.Bindable(true)>]
member this.CellPadding : int with get, set
member this.CellPadding : int with get, set
Public Overridable Property CellPadding As Integer

屬性值

表格儲存格的框線與內容之間的距離 (以像素為單位)。 預設值為 -1,表示這個屬性未設定。

屬性

範例

下列程式碼範例示範如何使用 CellPadding 屬性,以 10 圖元填補控制項的 RadioButtonList 儲存格。

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

<asp:RadioButtonList id="RadioButtonList1"
      CellPadding = "10"
      RepeatLayout="Table" 
      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="VB" AutoEventWireup="True" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>RadioButtonList.CellPadding Example</title>
</head>
<body>

<asp:RadioButtonList id="RadioButtonList1"
      CellPadding = "10"
      RepeatLayout="Table" 
      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>

備註

只在 RepeatLayout 屬性設為 RepeatLayout.Table 時,這個屬性才適用。

使用這個屬性來控制儲存格內容與儲存格框線之間的間距。

指定的填補量會新增至儲存格的所有四邊。 它會使用表格中最高儲存格的高度,以及表格中最寬儲存格的寬度。 產生的儲存格大小會統一套用至表格中的所有儲存格。 無法指定個別儲存格大小。

適用於

另請參閱