HOW TO
Instructions provided describe how to change the selection colors for a table.
Note:
Code in the Project's ThisDocument code module will only run in the current map document. If you want to store the code in all your map documents open the Normal.mxt ThisDocument code module instead.
Code:
Sub SwitchTableProps()
Dim pTableView As ITableView
Dim pApp As IApplication
Dim pTabWin As ITableWindow
Dim pDoc As IMxDocument
Dim pTableProps As ITableProperties
Dim pTableProp As ITableProperty
Dim pTableSelectionColor As ITableSelectionColor
'Get the table properties from the document
Set pDoc = ThisDocument
Set pTableProps = pDoc.TableProperties
pTableProps.RemoveAll
'Create new table properties
Set pTableProp = New TableProperty
'Get the first map in the document
Dim pLayer As IFeatureLayer
Set pLayer = pDoc.FocusMap.Layer(0)
Set pTableProp.Table = pLayer.FeatureClass
'Change the tables appearance
Set pTableProp.FeatureLayer = pLayer
'set the regular color of the selection
Set pTableProp.SelectionColor = BuildRGB(0, 255, 0)
pTableProps.Add pTableProp
Set pTableSelectionColor = pTableProps
'set the colour of the selection when only the selected features are being shown
Set pTableSelectionColor.SelectedTableSelectionColor = BuildRGB(255, 0, 0)
'Display the window
Set pApp = Application
Set pTabWin = New TableWindow
Set pTabWin.FeatureLayer = pLayer
Set pTabWin.Application = Application
pTabWin.ShowSelected = False
pTabWin.TableSelectionAction = esriSelectFeatures
pTabWin.Show True
End Sub
Private Function BuildRGB(pRed As Long, pGreen As Long, pBlue As Long) As IColor
Dim pRGB As IRgbColor
Set pRGB = New RgbColor
With pRGB
.Red = pRed
.Blue = pBlue
.Green = pGreen
.UseWindowsDithering = True
End With
Set BuildRGB = pRGB
End Function
Article ID:000007078
Get help from ArcGIS experts
Download the Esri Support App