'宣言 Public Delegate Sub AfterSummaryDialogEventHandler( _ ByVal sender As Object, _ ByVal e As AfterSummaryDialogEventArgs _ )
public delegate void AfterSummaryDialogEventHandler( object sender, AfterSummaryDialogEventArgs e )
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinGrid Private Sub UltraGrid1_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles UltraGrid1.InitializeLayout ' Set AllowRowSummaries to allow the user to select summaries. Me.UltraGrid1.DisplayLayout.Override.AllowRowSummaries = AllowRowSummaries.True End Sub Private Sub UltraGrid1_AfterSummaryDialog(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.AfterSummaryDialogEventArgs) Handles UltraGrid1.AfterSummaryDialog ' SummariesChanged property indicates if the user modified any summaries. If e.SummariesChanged And 0 = e.Column.Band.Index Then ' Find out if the user cleared the summaries for the column. Dim summariesCleared As Boolean = True Dim summary As SummarySettings For Each summary In e.Column.Band.Summaries ' If there is a summary with the source column of the column the user ' modified the summaries on then the user did not clear the summaries ' for the column. If summary.SourceColumn Is e.Column Then summariesCleared = False Exit For End If Next ' At this point the user has selected a new summary. To make the summary area ' visible, we need to scroll the last visible row into view. If Not summariesCleared Then Dim lastVisibleRow As UltraGridRow = Me.UltraGrid1.Rows.GetRowAtVisibleIndex(Me.UltraGrid1.Rows.VisibleRowCount - 1) Me.UltraGrid1.ActiveRowScrollRegion.ScrollRowIntoView(lastVisibleRow) End If End If End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { // Set AllowRowSummaries to allow the user to select summaries. this.ultraGrid1.DisplayLayout.Override.AllowRowSummaries = AllowRowSummaries.True; } private void ultraGrid1_AfterSummaryDialog(object sender, Infragistics.Win.UltraWinGrid.AfterSummaryDialogEventArgs e) { // SummariesChanged property indicates if the user modified any summaries. if ( e.SummariesChanged && 0 == e.Column.Band.Index ) { // Find out if the user cleared the summaries for the column. bool summariesCleared = true; foreach ( SummarySettings summary in e.Column.Band.Summaries ) { // If there is a summary with the source column of the column the user // modified the summaries on then the user did not clear the summaries // for the column. if ( summary.SourceColumn == e.Column ) { summariesCleared = false; break; } } // At this point the user has selected a new summary. To make the summary area // visible, we need to scroll the last visible row into view. if ( ! summariesCleared ) { UltraGridRow lastVisibleRow = this.ultraGrid1.Rows.GetRowAtVisibleIndex( this.ultraGrid1.Rows.VisibleRowCount - 1 ); this.ultraGrid1.ActiveRowScrollRegion.ScrollRowIntoView( lastVisibleRow ); } } }