'宣言 Public Property ColumnHeaderStyle As Infragistics.Win.HeaderStyle
public Infragistics.Win.HeaderStyle ColumnHeaderStyle {get; set;}
Imports Infragistics.Win Imports Infragistics.Win.UltraWinListView Private Sub ConfigureColumnHeaders() Dim detailsSettings As UltraListViewDetailsSettings = Me.ultraListView1.ViewSettingsDetails ' Set the ThemedElementAlpha property of the ColumnHeaderAppearance ' to 'Transparent' so that headers are not themed detailsSettings.ColumnHeaderAppearance.ThemedElementAlpha = Alpha.Transparent ' Set the borders for the column headers to 'RaisedSoft' detailsSettings.ColumnHeaderBorderStyle = UIElementBorderStyle.RaisedSoft ' Assign an ImageList to provide the images for the column headers detailsSettings.ColumnHeaderImageList = Me.columnHeaderImageList ' St the size for the column header images to (16 X 16) detailsSettings.ColumnHeaderImageSize = New Size(16, 16) ' Use the 'Standard' HeaderStyle detailsSettings.ColumnHeaderStyle = HeaderStyle.Standard ' Don't show the sort indicators detailsSettings.ColumnsShowSortIndicators = False End Sub Private Sub ultraListView1_ColumnSorted(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinListView.ColumnSortedEventArgs) Handles ultraListView1.ColumnSorted Dim listView As UltraListView = CType(sender, UltraListView) ' Assign an image to represent the sorted state If e.Column.Sorting = Sorting.Ascending Then e.Column.HeaderAppearance.Image = 0 ElseIf e.Column.Sorting = Sorting.Descending Then e.Column.HeaderAppearance.Image = 1 End If ' Clear the image from the other columns If Not e.Column Is listView.MainColumn Then listView.MainColumn.HeaderAppearance.Image = Nothing Dim column As UltraListViewSubItemColumn = Nothing For Each column In listView.SubItemColumns If Not column Is e.Column Then column.HeaderAppearance.Image = Nothing Next End Sub
using Infragistics.Win; using Infragistics.Win.UltraWinListView; using System.Diagnostics; private void ConfigureColumnHeaders() { this.ultraListView1.ImageTransparentColor = Color.Magenta; columnHeaderImageList = new ImageList(); columnHeaderImageList.Images.Add( Image.FromFile("C:\\ascending.bmp") ); columnHeaderImageList.Images.Add( Image.FromFile("C:\\descending.bmp") ); UltraListViewDetailsSettings detailsSettings = this.ultraListView1.ViewSettingsDetails; // Set the ThemedElementAlpha property of the ColumnHeaderAppearance // to 'Transparent' so that headers are not themed detailsSettings.ColumnHeaderAppearance.ThemedElementAlpha = Alpha.Transparent; // Set the borders for the column headers to 'RaisedSoft' detailsSettings.ColumnHeaderBorderStyle = UIElementBorderStyle.RaisedSoft; // Assign an ImageList to provide the images for the column headers detailsSettings.ColumnHeaderImageList = this.columnHeaderImageList; // St the size for the column header images to (16 X 16) detailsSettings.ColumnHeaderImageSize = new Size( 16, 16 ); // Use the 'Standard' HeaderStyle detailsSettings.ColumnHeaderStyle = HeaderStyle.Standard; // Don't show the sort indicators detailsSettings.ColumnsShowSortIndicators = false; } private void ultraListView1_ColumnSorted(object sender, Infragistics.Win.UltraWinListView.ColumnSortedEventArgs e) { UltraListView listView = sender as UltraListView; // Assign an image to represent the sorted state if ( e.Column.Sorting == Sorting.Ascending ) e.Column.HeaderAppearance.Image = 0; else if ( e.Column.Sorting == Sorting.Descending ) e.Column.HeaderAppearance.Image = 1; // Clear the image from the other columns if ( e.Column != listView.MainColumn ) listView.MainColumn.HeaderAppearance.Image = null; foreach( UltraListViewSubItemColumn column in listView.SubItemColumns ) { if ( column != e.Column ) column.HeaderAppearance.Image = null; } }