How to set background color in TOC?

2583
6
08-09-2010 06:16 AM
by Anonymous User
Not applicable
Original User: Mathias Westin

Hi!

Does anyone know how to set the background color of the TocControl? The reason we want to do this is so that white symbols and lines will get visible in the TOC.
0 Kudos
6 Replies
by Anonymous User
Not applicable
Original User: vini1

Hi,

i never used that, but maybe IMapControl4.backcolor could be the solution. But i'm not sure!


Vincent
0 Kudos
by Anonymous User
Not applicable
Original User: Mathias Westin

Hi Vincent!

The IMapControl4.BackColor is only changing the background color of the MapControl it doesen't have any effect on the TOCControl. The MapControl is connected to the TOCControl as a buddy so it should be aware of changes in the MapControl.

//OLE_Color = (Red) + (Green * 256) + (Blue * 256 * 256)
((IMapControl4)axMapControl1.Object).BackColor = 255;

I've also tried to set the BackColor on the AxMapControl but it also only effects the MapControl..

axMapControl1.BackColor = Color.Red;

Any other ideas?
0 Kudos
by Anonymous User
Not applicable
Original User: Mathias Westin

Update: We could not find a way to change the color of the TOC. So we change the background of the swatch instead. We did that by looping through layers casting to ILagendInfo and updating the bitmap in the IPictureMarkerSymbol, converting all pixels with background color to gray making the white symbols to show up.
by Anonymous User
Not applicable
Original User: Mathias Westin

We've tried almost everything you can do with the TOCControl and there is no way to change the background color. The only thing we haven't done is try to work with win32 API, that might be a possible way to do it... But the workaround that we done with the swatches is ok for now.
0 Kudos
YuanLiu
Occasional Contributor

I'm afraid this is a known limit of TOCControl logged as NIM011743