The BackColor property gets or sets the background color of the Web server control.
The following code shows how to apply the BackColor property to the C1WebTopicBarControl.
topicbar.BackColor = Color.AliceBlue
· C#
topicbar.BackColor = Color.AliceBlue;
· Delphi
topicbar.BackColor := Color.AliceBlue;
GroupStyle.BackColor property
The example below shows how to apply a different GroupStyle.BackColor property to the C1WebTopicBar control and the groups. To better illustrate the GroupStyle.BackColor property, this example also uses the Padding property.
'assign the padding property to the topicbar
topicbar.Padding = Unit.Pixel(20)
'assign the BackColor property to the topicbar
topicbar.BackColor = Color.AliceBlue
'assign the BackColor property to the GroupStyle object
topicbar.GroupStyle.BackColor = Color.LightGreen
· C#
//assign the padding property to the topicbar
topicbar.Padding = Unit.Pixel(20);
//assign the BackColor property to the topicbar
topicbar.BackColor = Color.AliceBlue;
//assign the BackColor property to the GroupStyle object
topicbar.GroupStyle.BackColor = Color.LightGreen;
· Delphi
//assign the padding property to the topicbar
topicbar.Padding := Unit.Pixel(20);
//assign the BackColor property to the topicbar
topicbar.BackColor := Color.AliceBlue;
//assign the BackColor property to the GroupStyle object
topicbar.GroupStyle.BackColor := Color.LightGreen;
To apply the BackColor property to the first group, Group[0], use the code below.
topicbar.Groups(0).GroupStyle.BackColor = Color.AntiqueWhite
· C#
topicbar.Groups[0].GroupStyle.BackColor = Color.AntiqueWhite;
· Delphi
topicbar.Groups[0].GroupStyle.BackColor := Color.AntiqueWhite;
ItemStyle.BackColor property
The ItemStyle.BackColor property gets or sets the background color of the items.
The following code shows how to apply the BackColor property to the ItemStyle of the C1WebTopicBarControl.
topicbar.ItemStyle.BackColor = Color.Orchid
· C#
topicbar.ItemStyle.BackColor = Color.Orchid;
· Delphi
topicbar.ItemStyle.BackColor := Color.Orchid;
For demonstration purposes, the next code example assigns the BackColor property to the first item, Item[0], of the C1WebTopicBar.
Note: The code below is applicable for the C1WebTopicBar, C1WebToolBar, and the C1WebTabStrip controls. The BackColor property for an individual item in the C1WebMenu and C1WebTreeView controls is applied differently.
CType(topicbar.Groups(0).Items(0), C1WebLinkItem).ItemStyle.BackColor = Color.Orchid
· C#
((C1WebLinkItem)topicbar.Groups[0].Items[0]).ItemStyle.BackColor = Color.Orchid;
· Delphi
((C1WebLinkItem)topicbar.Groups[0].Items[0]).ItemStyle.BackColor := Color.Orchid;
The code below shows how to use the BackColor property for specific items using the C1WebMenu control. The C1WebTreeView control can be used the same way.
CType(menu.Items(0), C1WebMenuItem).ItemStyle.BackColor = Color.Orchid
· C#
((C1WebMenuItem)menu.Items[0]).ItemStyle.BackColor = Color.Orchid;
· Delphi
((C1WebMenuItem)menu.Items[0]).ItemStyle.BackColor := Color.Orchid;
Send comments about this topic to ComponentOne. Copyright © ComponentOne LLC. All rights reserved. |