'宣言 Public Event ColumnResized As ColumnResizedEventHandler
public event ColumnResizedEventHandler ColumnResized
イベント ハンドラが、このイベントに関連するデータを含む、ColumnResizedEventArgs 型の引数を受け取りました。次の ColumnResizedEventArgs プロパティには、このイベントの固有の情報が記載されます。
プロパティ | 解説 |
---|---|
Cancel System.ComponentModel.CancelEventArgsから継承されます。 | |
Column Infragistics.Win.UltraWinListView.CancelableColumnEventArgsから継承されます。 |
Imports Infragistics.Win Imports Infragistics.Win.UltraWinListView Private Sub ultraListView1_ColumnResizing(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinListView.ColumnResizingEventArgs) Handles ultraListView1.ColumnResizing ' If the column about to be resized is the MainColumn, cancel ' the event to prevent the column from being resized. If (e.Column.GetType() Is GetType(UltraListViewMainColumn)) Then e.Cancel = True End Sub Private Sub ultraListView1_ColumnResized(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinListView.ColumnResizedEventArgs) Handles ultraListView1.ColumnResized Dim listView As UltraListView = CType(sender, UltraListView) ' Get a rectangle which describes the client area ' of the control, so we can determine the width ' minus the width of the vertical scrollbar, if ' one is present. Dim displayRect As Rectangle = listView.DisplayRectangle Dim clientWidth As Integer = displayRect.Width ' Subtract out the width of the MainColumn Dim mainColumnWidth As Integer = IIf(listView.MainColumn.Width > 0, listView.MainColumn.Width, 200) clientWidth -= mainColumnWidth ' Iterate the SubItemColumns collection to get the number of ' visible columns. Dim visibleByDefault As Boolean = listView.ViewSettingsDetails.SubItemColumnsVisibleByDefault Dim visibleColumnsCount As Integer = 0 Dim subItemColumn As UltraListViewSubItemColumn For Each subItemColumn In listView.SubItemColumns If (subItemColumn.VisibleInDetailsView = DefaultableBoolean.True Or _ (visibleByDefault AndAlso subItemColumn.VisibleInDetailsView = DefaultableBoolean.Default)) Then visibleColumnsCount += 1 End If Next ' Iterate the SubItemColumns collection and set the width For Each subItemColumn In listView.SubItemColumns subItemColumn.Width = Math.Floor((clientWidth / visibleColumnsCount)) Next End Sub
using Infragistics.Win; using Infragistics.Win.UltraWinListView; using System.Diagnostics; private void ultraListView1_ColumnResizing(object sender, Infragistics.Win.UltraWinListView.ColumnResizingEventArgs e) { // If the column about to be resized is the MainColumn, cancel // the event to prevent the column from being resized. if ( e.Column is UltraListViewMainColumn ) e.Cancel = true; } private void ultraListView1_ColumnResized(object sender, Infragistics.Win.UltraWinListView.ColumnResizedEventArgs e) { UltraListView listView = sender as UltraListView; // Get a rectangle which describes the client area // of the control, so we can determine the width // minus the width of the vertical scrollbar, if // one is present. Rectangle displayRect = listView.DisplayRectangle; int clientWidth = displayRect.Width; // Subtract out the width of the MainColumn clientWidth -= listView.MainColumn.Width > 0 ? listView.MainColumn.Width : 200; // Iterate the SubItemColumns collection to get the number of // visible columns. bool visibleByDefault = listView.ViewSettingsDetails.SubItemColumnsVisibleByDefault; int visibleColumnsCount = 0; foreach( UltraListViewSubItemColumn subItemColumn in listView.SubItemColumns ) { bool visible = subItemColumn.VisibleInDetailsView == DefaultableBoolean.True || (visibleByDefault && subItemColumn.VisibleInDetailsView == DefaultableBoolean.Default); if ( visible ) visibleColumnsCount++; } // Iterate the SubItemColumns collection and set the width foreach( UltraListViewSubItemColumn subItemColumn in listView.SubItemColumns ) { subItemColumn.Width = (int)(clientWidth / visibleColumnsCount); } } }