TableStyle 类

定义

表示 Table 控件的样式和一些 Web 部件。Represents the style for the Table control and some Web Parts.

public ref class TableStyle : System::Web::UI::WebControls::Style
public class TableStyle : System.Web.UI.WebControls.Style
type TableStyle = class
    inherit Style
Public Class TableStyle
Inherits Style
继承
派生

示例

下面的示例创建一个TableStyle对象, 然后ApplyStyle使用方法将其应用于生成Table的对象。The following example creates a TableStyle object and then uses the ApplyStyle method to apply it to a generated Table object.

注解

TableStyle类用于表示表控件的样式。The TableStyle class is used to represent the style for a table control. 它封装属性, 这些属性控制表的外观, 并且可以应用于多个表控件以提供常见的外观。It encapsulates the properties that control the appearance of a table and can be applied to multiple table controls to provide a common appearance.

您可以通过设置BackImageUrl属性来指定在表的背景中显示的图像。You can specify an image to display in the background of the table by setting the BackImageUrl property. 表的单元格之间的间距量由CellSpacing属性控制。The amount of spacing between the cells of a table is controlled by the CellSpacing property. 单元格的内容和单元格边框之间的间距是使用CellPadding属性指定的。The spacing between the contents of a cell and the cell border is specified using the CellPadding property. 您可以通过设置GridLines属性来指定是否显示单元格边框。You can specify whether cell borders are displayed by setting the GridLines property. 相对于 Web 窗体页上的其他元素, 表的水平对齐方式由HorizontalAlign属性指示。The horizontal alignment of the table in relation to other elements on the Web Forms page is indicated by the HorizontalAlign property.

备注

此类主要由控件开发人员使用。This class is primarily used by control developers.

构造函数

TableStyle()

使用默认值初始化 TableStyle 类的新实例。Initializes a new instance of the TableStyle class using default values.

TableStyle(StateBag)

用指定的状态袋信息初始化 TableStyle 类的新实例。Initializes a new instance of the TableStyle class with the specified state bag information.

属性

BackColor

获取或设置 Web 服务器控件的背景色。Gets or sets the background color of the Web server control.

(继承自 Style)
BackImageUrl

获取或设置要在表控件的背景中显示的图像的 URL。Gets or sets the URL of an image to display in the background of a table control.

BorderColor

获取或设置 Web 服务器控件的边框颜色。Gets or sets the border color of the Web server control.

(继承自 Style)
BorderStyle

获取或设置 Web 服务器控件的边框样式。Gets or sets the border style of the Web server control.

(继承自 Style)
BorderWidth

获取或设置 Web 服务器控件的边框宽度。Gets or sets the border width of the Web server control.

(继承自 Style)
CanRaiseEvents

获取一个指示组件是否可以引发事件的值。Gets a value indicating whether the component can raise an event.

(继承自 Component)
CellPadding

获取或设置单元格内容和单元格边框之间的空间量。Gets or sets the amount of space between the contents of the cell and the cell's border.

CellSpacing

获取或设置表单元格之间的距离。Gets or sets the distance between table cells.

Container

获取 IContainer,它包含 ComponentGets the IContainer that contains the Component.

(继承自 Component)
CssClass

获取或设置由 Web 服务器控件在客户端呈现的级联样式表 (CSS) 类。Gets or sets the cascading style sheet (CSS) class rendered by the Web server control on the client.

(继承自 Style)
DesignMode

获取一个值,用以指示 Component 当前是否处于设计模式。Gets a value that indicates whether the Component is currently in design mode.

(继承自 Component)
Events

获取附加到此 Component 的事件处理程序的列表。Gets the list of event handlers that are attached to this Component.

(继承自 Component)
Font

获取与 Web 服务器控件关联的字体属性。Gets the font properties associated with the Web server control.

(继承自 Style)
ForeColor

获取或设置 Web 服务器控件的前景色(通常是文本颜色)。Gets or sets the foreground color (typically the color of the text) of the Web server control.

(继承自 Style)
GridLines

获取或设置一个值,该值指定是否显示表控件的单元格之间的边框。Gets or sets a value that specifies whether the border between the cells of the table control is displayed.

Height

获取或设置 Web 服务器控件的高度。Gets or sets the height of the Web server control.

(继承自 Style)
HorizontalAlign

获取或设置表在其容器内的水平对齐方式。Gets or sets the horizontal alignment of the table within its container.

IsEmpty

保护属性。A protected property. 获取一个值,该值指示是否已在状态袋中定义任何样式元素。Gets a value indicating whether any style elements have been defined in the state bag.

(继承自 Style)
IsTrackingViewState

返回一个值,该值指示状态袋中是否有任何已定义的样式元素。Returns a value indicating whether any style elements have been defined in the state bag.

(继承自 Style)
RegisteredCssClass

获取已向控件注册的级联样式表 (CSS) 类。Gets the cascading style sheet (CSS) class that is registered with the control.

(继承自 Style)
Site

获取或设置 ISiteComponentGets or sets the ISite of the Component.

(继承自 Component)
ViewState

获取保存样式元素的状态袋。Gets the state bag that holds the style elements.

(继承自 Style)
Width

获取或设置 Web 服务器控件的宽度。Gets or sets the width of the Web server control.

(继承自 Style)

方法

AddAttributesToRender(HtmlTextWriter)

将需要呈现的 HTML 特性和样式添加到指定的 HtmlTextWriter 中。Adds HTML attributes and styles that need to be rendered to the specified HtmlTextWriter. 此方法主要由控件开发人员使用。This method is primarily used by control developers.

(继承自 Style)
AddAttributesToRender(HtmlTextWriter, WebControl)

将有关背景图像、单元格间距、单元格填充、网格线和对齐方式的信息添加到要呈现的特性列表中。Adds information about the background image, cell spacing, cell padding, gridlines, and alignment to the list of attributes to render.

CopyFrom(Style)

从指定的样式中复制非空白元素,如有必要则覆盖现有的样式元素。Copies non-blank elements from the specified style, overwriting existing style elements if necessary.

CreateObjRef(Type)

创建一个对象,该对象包含生成用于与远程对象进行通信的代理所需的全部相关信息。Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.

(继承自 MarshalByRefObject)
Dispose()

释放 Component 使用的所有资源。Releases all resources used by the Component.

(继承自 Component)
Dispose(Boolean)

释放 Component 使用的非托管资源,并选择性地释放托管资源。Releases the unmanaged resources used by the Component and optionally releases the managed resources.

(继承自 Component)
Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
FillStyleAttributes(CssStyleCollection, IUrlResolutionService)

TableStyle 对象的样式属性添加到指定的 CssStyleCollection 集合中。Adds the style properties of the TableStyle object to the specified CssStyleCollection collection.

GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetLifetimeService()

检索控制此实例的生存期策略的当前生存期服务对象。Retrieves the current lifetime service object that controls the lifetime policy for this instance.

(继承自 MarshalByRefObject)
GetService(Type)

返回一个对象,该对象表示由 Component 或它的 Container 提供的服务。Returns an object that represents a service provided by the Component or by its Container.

(继承自 Component)
GetStyleAttributes(IUrlResolutionService)

检索实现了 CssStyleCollection 的指定对象的 IUrlResolutionService 对象。Retrieves the CssStyleCollection object for the specified IUrlResolutionService-implemented object.

(继承自 Style)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
InitializeLifetimeService()

获取生存期服务对象来控制此实例的生存期策略。Obtains a lifetime service object to control the lifetime policy for this instance.

(继承自 MarshalByRefObject)
LoadViewState(Object)

加载以前保存的状态。Loads the previously saved state.

(继承自 Style)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
MemberwiseClone(Boolean)

创建当前 MarshalByRefObject 对象的浅表副本。Creates a shallow copy of the current MarshalByRefObject object.

(继承自 MarshalByRefObject)
MergeWith(Style)

从指定的样式中复制非空白元素,但不覆盖任何现有的样式元素。Copies non-blank elements from the specified style, but will not overwrite any existing style elements.

Reset()

清除样式的任何定义的样式元素。Clears any defined style elements of the style.

SaveViewState()

受保护的方法。A protected method. 保存在调用 TrackViewState() 方法后已修改的任何状态。Saves any state that has been modified after the TrackViewState() method was invoked.

(继承自 Style)
SetBit(Int32)

受保护的内部方法。A protected internal method. 设置一个内部位屏蔽字段以指示存储在状态袋中的样式属性。Sets an internal bitmask field that indicates the style properties that are stored in the state bag.

(继承自 Style)
SetDirty()

标记 Style 以便在视图状态中记录其状态。Marks the Style so that its state will be recorded in view state.

(继承自 Style)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Style)
TrackViewState()

受保护的方法。A protected method. 标记跟踪控件状态更改的起始点。Marks the beginning for tracking state changes on the control. 跟踪开始之后所做的任何更改都将被跟踪并保存到控件视图状态中。Any changes made after tracking has begun will be tracked and saved as part of the control view state.

(继承自 Style)

事件

Disposed

当通过调用 Dispose() 方法释放组件时发生。Occurs when the component is disposed by a call to the Dispose() method.

(继承自 Component)

显式接口实现

IStateManager.IsTrackingViewState

获取一个值,该值指示服务器控件是否在跟踪其视图状态更改。Gets a value that indicates whether a server control is tracking its view state changes.

(继承自 Style)
IStateManager.LoadViewState(Object)

加载以前保存的状态。Loads the previously saved state.

(继承自 Style)
IStateManager.SaveViewState()

返回包含状态更改的对象。Returns the object containing state changes.

(继承自 Style)
IStateManager.TrackViewState()

开始跟踪状态更改。Starts tracking state changes.

(继承自 Style)

适用于

另请参阅