'宣言 Public Event DoubleClickHeader As DoubleClickHeaderEventHandler
public event DoubleClickHeaderEventHandler DoubleClickHeader
イベント ハンドラが、このイベントに関連するデータを含む、DoubleClickHeaderEventArgs 型の引数を受け取りました。次の DoubleClickHeaderEventArgs プロパティには、このイベントの固有の情報が記載されます。
プロパティ | 解説 |
---|---|
Header Infragistics.Win.UltraWinGrid.HeaderEventArgsから継承されます。 | ヘッダーを返します。 |
Private Sub ultraGrid1_DoubleClickHeader(sender As Object, e As Infragistics.Win.UltraWinGrid.DoubleClickHeaderEventArgs) Handles Me.ultraGrid1.DoubleClickHeader ' If the user double-clicked on the "lname" column in the "customers" band ' then copy a comma-separated list of all the last names in that column to ' the Windows clipboard. ' If e.Header.Band.Key = "customers" And e.Header.Column.Key = "lname" Then ' If there are no rows then there is nothing to do. ' If Me.ultraGrid1.Rows.Count = 0 Then Return End If ' Create a StringBuilder with roughly the initial capactity to hold all the last names. ' Dim sb As New System.Text.StringBuilder(Me.ultraGrid1.Rows.Count * 8) ' Loop over all the rows in the first band and append each last name ' to the comma-separated list of values. ' Dim row As UltraGridRow For Each row In Me.ultraGrid1.Rows sb.AppendFormat("{0}, ", row.Cells("lname").Text) Next row ' Remove the final comma and space. ' sb.Remove(sb.Length - 2, 2) ' Put the comma-separated list of last names on the clipboard. ' Clipboard.SetDataObject(sb.ToString(), True) End If End Sub
private void ultraGrid1_DoubleClickHeader(object sender, Infragistics.Win.UltraWinGrid.DoubleClickHeaderEventArgs e) { // If the user double-clicked on the "lname" column in the "customers" band // then copy a comma-separated list of all the last names in that column to // the Windows clipboard. // if( e.Header.Band.Key == "customers" && e.Header.Column.Key == "lname" ) { // If there are no rows then there is nothing to do. // if( this.ultraGrid1.Rows.Count == 0 ) return; // Create a StringBuilder with roughly the initial capactity to hold all the last names. // System.Text.StringBuilder sb = new System.Text.StringBuilder( this.ultraGrid1.Rows.Count * 8 ); // Loop over all the rows in the first band and append each last name // to the comma-separated list of values. // foreach( UltraGridRow row in this.ultraGrid1.Rows ) sb.AppendFormat( "{0}, ", row.Cells["lname"].Text ); // Remove the final comma and space. // sb.Remove( sb.Length - 2, 2 ); // Put the comma-separated list of last names on the clipboard. // Clipboard.SetDataObject( sb.ToString(), true ); } }