GridData.SetCellBackgroundColor

Introduced

v12.0 (2014)

Description

Set the given cell's background color.

C# Syntax

GridData.SetCellBackgroundColor( Int32 in_lCol, Int32 in_lRow, Color in_pColor );

Scripting Syntax

GridData.SetCellBackgroundColor( Column, Row, Color );

Parameters

Parameter Type Description
Column Long Column index of the cell.
Row Long Row index of the cell.
Color Color The desired background color.

Examples

Python Example

import win32com.client

from win32com.client import constants as C

propName = "TheProperty"

gridDataName = "TheGrid"

siProperty = Application.ActiveSceneRoot.AddProperty( "CustomProperty", False, propName ) 

gridData = siProperty.AddGridParameter(gridDataName).Value 

gridData.ColumnCount = 3

gridData.RowCount = 3

for row in range( 3 ):

	gridData.SetRowLabel( row, "Row %d"%row )

	for col in range ( 3 ):

		if row == 1:

			gridData.SetColumnLabel( col, "Col %d"%col )

		gridData.SetCell( col, row, "%d,%d"%( col, row ) )

Application.InspectObj( siProperty )

# Set third row background color to Blue

color = gridData.GetCellBackgroundColor( 0, 2 )

color.Red = 0

color.Green = 0

color.Blue = 255

for col in range(3):

	gridData.SetCellBackgroundColor( col, 2, color )

See Also

GridData.GetCellBackgroundColor