'Declaration Public Class CancelableAutoSizeEditEventArgs Inherits System.ComponentModel.CancelEventArgs
public class CancelableAutoSizeEditEventArgs : System.ComponentModel.CancelEventArgs
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinGrid Private Sub Button6_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button6.Click ' Following code enables auto-size-edit feature on the Address column. ' It also makes the column multiline. Me.ultraGrid1.DisplayLayout.Bands(0).Columns("Address").AutoSizeEdit = DefaultableBoolean.True Me.ultraGrid1.DisplayLayout.Bands(0).Columns("Address").CellMultiLine = DefaultableBoolean.True End Sub Private Sub UltraGrid1_BeforeAutoSizeEdit(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.CancelableAutoSizeEditEventArgs) Handles ultraGrid1.BeforeAutoSizeEdit ' BeforeAutoSizeEdit gets fired when a cell in a column with AutoSizeEdit set to True ' is going into edit mode. ' Set the start width of the edit control. This is the width the edit control in the ' cell will start out with. If Me.ultraGrid1.ActiveCell.Column.Width < 250 Then e.StartWidth = 250 End If If Me.ultraGrid1.ActiveCell.Column.CellMultiLine = DefaultableBoolean.True And Me.ultraGrid1.ActiveCell.Row.Height < 100 Then e.StartHeight = 100 End If ' Set the max width and height. The UltraGrid will not resize the edit control ' larger than max height and max width. e.MaxHeight = 400 e.MaxWidth = 400 ' One can cancel auto-size-edit in which case the cell will do regular editing. Dim cancelAutoSizeEdit As Boolean = False If cancelAutoSizeEdit Then e.Cancel = True End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; private void button6_Click(object sender, System.EventArgs e) { // Following code enables auto-size-edit feature on the Address column. // It also makes the column multiline. this.ultraGrid1.DisplayLayout.Bands[0].Columns["Address"].AutoSizeEdit = DefaultableBoolean.True; this.ultraGrid1.DisplayLayout.Bands[0].Columns["Address"].CellMultiLine = DefaultableBoolean.True; } private void ultraGrid1_BeforeAutoSizeEdit(object sender, Infragistics.Win.UltraWinGrid.CancelableAutoSizeEditEventArgs e) { // BeforeAutoSizeEdit gets fired when a cell in a column with AutoSizeEdit set to True // is going into edit mode. // Set the start width of the edit control. This is the width the edit control in the // cell will start out with. if ( this.ultraGrid1.ActiveCell.Column.Width < 250 ) e.StartWidth = 250; if ( this.ultraGrid1.ActiveCell.Column.CellMultiLine == DefaultableBoolean.True && this.ultraGrid1.ActiveCell.Row.Height < 100 ) e.StartHeight = 100; // Set the max width and height. The UltraGrid will not resize the edit control // larger than max height and max width. e.MaxHeight = 400; e.MaxWidth = 400; // One can cancel auto-size-edit in which case the cell will do regular editing. bool cancelAutoSizeEdit = false; if ( cancelAutoSizeEdit ) e.Cancel = true; }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2