These styles override those inherited from higher levels.ĭataGridViewCell, DataGridViewRow, DataGridViewColumn, and derived classes Gets or sets styles specified at the cell level. Overridden by the current theme if visual styles are enabled. Gets or sets default cell styles used by the control's column headers. Gets or sets default cell styles used by the control's row headers. Gets or sets default cell styles used by alternating rows in the control. Gets or sets default cell styles used by all rows in the control. Gets or sets default styles used by all cells in the entire control (including header cells), in a column, or in a row. PropertyĭataGridView, DataGridViewColumn, DataGridViewRow, and derived classes The following table lists the primary properties that get or set DataGridViewCellStyle objects. This is described in more detail in the Style Inheritance section that follows. Because the styles set at the control, column, and row levels filter down through each level to the cell level, you can also avoid style duplication by setting only those style properties at each level that differ from the levels above. You can avoid unnecessary duplication of style information by sharing DataGridViewCellStyle objects among multiple DataGridView elements. You can also instantiate your own DataGridViewCellStyle objects and assign them to these properties. If one of these properties has not yet been set, retrieving its value will create a new DataGridViewCellStyle object. You can retrieve DataGridViewCellStyle objects from various properties of the DataGridView, DataGridViewColumn, DataGridViewRow, and DataGridViewCell classes and their derived classes. This class also contains the following properties related to formatting:įor more information on these properties and other cell-style properties, see the DataGridViewCellStyle reference documentation and the topics listed in the See Also section below. SelectionBackColor and SelectionForeColor The DataGridViewCellStyle class contains the following properties related to visual style: For example, you may want every cell in a DataGridView control to use the same font, but only cells in currency columns to use currency format, and only currency cells with negative numbers to use a red foreground color. Because these groups overlap, each cell may get its styling information from more than one place. Groups of cells that share styles may include all cells within particular rows or columns, all cells that contain particular values, or all cells in the control. Typically, however, multiple cells will share particular style characteristics. Each cell within the DataGridView control can have its own style, such as text format, background color, foreground color, and font.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |