Main Menu
Knowledge Base
Product Registration
Log an Incident
Request a Feature
Search Incidents/Bug Reports


Search KB

Please note: In an effort to better serve you, we are in the process of restructuring DevCenter. In the process, we have moved many items that you may be used to finding in DevCenter over to the Main Site. If you are having trouble locating something, please try looking at the following places:

Knowledge Base Article: KB01985

HOWTO:UltraWinGrid Headings


The information in this article applies to:
UltraWinGrid (v1.0.5005)
  Article Created: 
7/25/2002

Last Updated:
7/26/2002

Article Type
How To
  
Page Options
Average Rating:
2 out of 10

Rate this page
Print this page
E-mail this page
Add to Favorites

Summary

The UltraWinGrid displays many different headings (captions), over which the developer has control of the content and appearance.

Additional Information

Questions
How do I change the Grid Caption appearance?

How do I change the appearance of the column headers?

How do I get the band headers to display and how do I change the band header appearance?

Solutions
The answer to these questions varies based on where the heading information is found. This sample project shows how to change the appearance of most of the headings found in the UltraWinGrid.

Step-By-Step Example

This sample project allows the user to click the buttons and set the corresponding heading.

This sample project consists of the following files:

clsCustomerData.vb - contains code to create a sample Customers DataTable. This code is not reviewed.

clsCustOrderData.vb - contains code to create a sample Customer/Orders DataSet. This code is not reviewed.

clsOrderData.vb - contains code to create a sample Orders DataTable. This code is not reviewed.

Form1.vb - contains the code relevant to this project and consists of the following Code Regions:

Form Events

The Form Events Region contains the following event handlers:

MyBase.Load - The Form Load event creates a sample DataSet and binds it to the UltraWinGrid:

' create and bind sample DataSet
Dim CustOrderData As New clsCustOrderDataSet()
UltraGrid1.DataSource = CustOrderData.MakeCustOrderDataSet

UltraGrid Events

The UltraGrid Events Region contains the following event handlers:

UltraGrid1.InitializeRow - The code in the InitializeRow event expands the rows in band 0:

' expand rows in band 0
Select Case e.Row.Band.Index

Case 0

e.Row.Expanded = True

End Select

Checkbox Events

The Checkbox Events Region contains the following event handlers:

chkSupportThemes.CheckedChanged - The code in this event sets the grid .SupportThemes property based on the check box value:

' set ultragrid1 themes based on check box value
If chkSupportThemes.Checked = True Then

UltraGrid1.SupportThemes = True

Else

UltraGrid1.SupportThemes = False

End If

Button Events

The Button Events Region contains the following event handlers:

btnGridHeading.Click - The code of the Grid Heading Button Click event turns off Themes, sets the grid caption text and sets the back color of the grid heading area:

chkSupportThemes.Checked = False
UltraGrid1.Text = "Test Grid"
UltraGrid1.DisplayLayout.CaptionAppearance.BackColor = Color.LightYellow

btnSetBand0Heading.Click - The code of the Set Band 0 Heading Button Click event turns off Themes, turns on the Band Header, sets the caption text and sets the background color of the band heading area:

chkSupportThemes.Checked = False
With UltraGrid1.DisplayLayout.Bands(0)

.HeaderVisible = True
.Header.Caption = "Band 0 Header"
.Header.Appearance.BackColor = Color.LightYellow

End With

btnSetBand1Heading.Click - The code of the Set Band 1 Heading Button Click event turns off Themes, turns on the Band Header, sets the caption text and sets the background color of the band heading area:

chkSupportThemes.Checked = False
With UltraGrid1.DisplayLayout.Bands(1)

.HeaderVisible = True
.Header.Caption = "Band 1 Header"
.Header.Appearance.BackColor = Color.LightYellow

End With

btnSetBand0ColumnHeaders.Click - The code of the Set Band 0 Column Headers Button Click event turns off Themes and sets the background color of the column headers for band 0:

chkSupportThemes.Checked = False
With UltraGrid1.DisplayLayout.Bands(0)

.Override.HeaderAppearance.BackColor = Color.LightYellow

End With

btnSetBand1ColumnHeaders.Click - The code of the Set Band 1 Column Headers Button Click event turns off Themes and sets the background color of the column headers for band 1:

chkSupportThemes.Checked = False
With UltraGrid1.DisplayLayout.Bands(1)

.Override.HeaderAppearance.BackColor = Color.LightYellow

End With

btnSetOrderIDColumnHeader.Click - The code of the Set OrderID Column Header Button Click event turns off Themes, sets the column header caption text, and sets the back color of the column header area:

chkSupportThemes.Checked = False
With UltraGrid1.DisplayLayout.Bands(1).Columns("OrderID").Header

.Caption = "Order ID"
.Appearance.BackColor = Color.LightCoral

End With

btnCardViewHeader.Click - The code in the Card View Header Button Click Event turns off Themes, sets band 1 to use Card View, sets the caption field name to use the OrderID field, turns on ShowCaptions, and sets the background and foreground colors of the card caption appearance:

chkSupportThemes.Checked = False
With UltraGrid1.DisplayLayout.Bands(1)

.CardView = True
.CardSettings.CaptionField = "OrderID"
.CardSettings.ShowCaption = True
.Override.CardCaptionAppearance.BackColor = Color.Blue
.Override.CardCaptionAppearance.ForeColor = Color.White

End With

btnGroupHeader.Click - The code in the Group Header Button Click Event turns off Themes, creates a group, sets the level count to 2, applies groups and levels to the columns, and sets the background color of the group heading area:

chkSupportThemes.Checked = False
With UltraGrid1.DisplayLayout.Bands(1)

If .Groups.Exists("Orders") = True Then Exit Sub
.Groups.Add("Orders")
.LevelCount = 2
.Columns("CustomerID").Group = .Groups("Orders")
.Columns("CustomerID").Level = 0
.Columns("OrderID").Group = .Groups("Orders")
.Columns("OrderID").Level = 0
.Columns("EmployeeID").Group = .Groups("Orders")
.Columns("EmployeeID").Level = 1
.Columns("OrderDate").Group = .Groups("Orders")
.Columns("OrderDate").Level = 1
.Groups("Orders").Header.Appearance.BackColor = Color.LightSteelBlue

End With

Review
This sample project shows how to manipulate the many of the headings displayed by the UltraWinGrid.

Samples

ultrawingrid_tutorial_headings.zip
 UltraWinGrid Tutorial Headings



How would you rate the quality of this content?
Poor -----------------------------------------> Outstanding

Tell us why you rated the content this way. (optional)