ComponentOne WebMenus and WebBars for ASP.NET: Defining the GroupStyle and ItemStyle Classes > Common GroupStyle and ItemStyle Properties > Height Property

Height Property

The Height property gets or sets the height of the Web server control.

The three code examples below show how to assign the Height property to the control and the groups. For illustration purposes, each example below has the control and the GroupStyle object's BackColor property assigned. Each example also has a border width of 1 pixel so you can see the height better for each group or item.

GroupStyle.Height property

This code example shows how to apply the Height property to the C1WebTopicBar control.

      Visual Basic

topicbar.BorderWidth = Unit.Pixel(1)

topicbar.Height = Unit.Pixel(200)

      C#

topicbar.BorderWidth = Unit.Pixel(1)

topicbar.Height = Unit.Pixel(200)

The Height property is assigned to the GroupStyle object of the C1WebTopic control in the code below.

      Visual Basic

topicbar.GroupStyle.BorderWidth = Unit.Pixel(1)

topicbar.GroupStyle.Height = Unit.Pixel(100)

      C#

topicbar.GroupStyle.BorderWidth = Unit.Pixel(1);

topicbar.GroupStyle.Height = Unit.Pixel(100);

Notice how the GroupStyle property gets the height for both groups. This is because the GroupStyle property assigns the height to all of the groups in the Web control.

For demonstration purposes, the next example assigns the Height property to a specific group. The code example below assigns the Height property to the first group, Group[0], of the C1WebTopicBar.

      Visual Basic

topicbar.GroupStyle.BorderWidth = Unit.Pixel(1)

topicbar.Groups(0).GroupStyle.Height = Unit.Pixel(100)

      C#

topicbar.GroupStyle.BorderWidth = Unit.Pixel(1);

topicbar.Groups[0].GroupStyle.Height = Unit.Pixel(100);

ItemStyle.Height property

The Height property is assigned to the ItemStyle object in the code below.

      Visual Basic

topicbar.ItemStyle.BorderWidth = Unit.Pixel(1)

topicbar.ItemStyle.Height = Unit.Pixel(100)

      C#

topicbar.ItemStyle.BorderWidth = Unit.Pixel(1);

topicbar.ItemStyle.Height = Unit.Pixel(100);

Notice how the ItemStyle property gets the height for every item. This is because the ItemStyle property assigns the height size to every item in the Web control.

This example assigns the Height property to item 1 of Group 2.

Note: The code below is applicable for the flat controls: C1WebTopicBar, C1WebToolBar, and the C1WebTabStrip. The mechanism for specifying a specific item index is different for the tree type controls: C1WebTreeView and C1WebMenu. Please see the Tree View Control Type in the ItemStyle Class topic section, for a generic example how to set a specific item for the C1WebMenu and the C1WebTreeView

      Visual Basic

topicbar.ItemStyle.BorderWidth = Unit.Pixel(1)

CType(topicbar.Groups(1).Items(0), C1WebLinkItem).ItemStyle.Height = Unit.Pixel(100)

      C#

topicbar.ItemStyle.BorderWidth = Unit.Pixel(1);

((C1WebLinkItem)topicbar.Groups[1].Items[0]).ItemStyle.Height = Unit.Pixel(100);


Send comments about this topic to ComponentOne.
Copyright © 1987-2009 ComponentOne LLC. All rights reserved.