■ UltraGrid 클래스에서 사용자가 클릭한 셀을 구하는 방법을 보여준다.
▶ 예제 코드 (C#)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
using System.Windows.Forms; using Infragistics.Win.UltraWinEditors; using Infragistics.Win.UltraWinGrid; private UltraGrid ultraGrid; private UltraTextEditor ultraTextEditor; ... #region UltraGrid 레이아웃 초기화 하기 - ultraGrid_InitializeLayout(sender, e) /// <summary> /// UltraGrid 레이아웃 초기화 하기 /// </summary> /// <param name="sender">이벤트 발생자</param> /// <param name="e">이벤트 인자</param> private void ultraGrid_InitializeLayout(object sender, InitializeLayoutEventArgs e) { e.Layout.Override.CellClickAction = CellClickAction.CellSelect; } #endregion #region UltraGrid 마우스 UP 처리하기 - ultraGrid_MouseUp(sender, e) /// <summary> /// UltraGrid 마우스 UP 처리하기 /// </summary> /// <param name="sender">이벤트 발생자</param> /// <param name="e">이벤트 인자</param> private void ultraGrid_MouseUp(object sender, MouseEventArgs e) { UIElement uiElement = this.ultraGrid.DisplayLayout.UIElement.ElementFromPoint(e.Location); UltraGridCell ultraGridCell = uiElement.GetContext(typeof(UltraGridCell)) as UltraGridCell; if(ultraGridCell != null) { this.ultraTextEditor.Text = string.Format ( "Band : {0}, Column : {1}", ultraGridCell.Band.Index.ToString(), ultraGridCell.Column.ToString() ); } else { this.ultraTextEditor.Text = string.Empty; } } #endregion |