'宣言 Public Property ActiveRowScrollRegion As RowScrollRegion
public RowScrollRegion ActiveRowScrollRegion {get; set;}
ActiveRowScrollRegion プロパティは、現在アクティブな RowScrollRegion オブジェクトを決定するために使用します。RowScrollRegion オブジェクトを ActiveRowScrollRegion プロパティに割り当てると、それがアクティブな行スクロール領域になります。
一度にアクティブになる行スクロール領域は、アクティブな RowScrollRegion ひとつだけです。アクティブ RowScrollRegion は、アクティブ行を含む領域です (ActiveRow プロパティで指定される)。これはキーボード移動フォーカスを受け取る行スクロール領域でもあります。たとえば、上下の矢印キーを使用して行をスクロールする場合、ActiveRowScrollRegion によって指定される行スクロール領域の行が移動します。
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinGrid Imports System.Diagnostics Private Sub Button56_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button56.Click ' Get the cell you want to get the location of. Dim cell As UltraGridCell = Me.UltraGrid1.ActiveCell If Not Nothing Is cell Then ' If there are multiple scroll regions, then we have to specify which scroll region to ' get the ui element in. A cell could be visible in multiple places if you had split the ' grid in two or more scroll regions. Intersection of ActiveRowScrollRegion and the ' ActiveColScrollRegion make up the active scroll region which is where the edit control ' would be positioned by the UltraGrid for editing the cell's contents if the cell were ' in edit mode. Dim rsr As RowScrollRegion = Me.ultraGrid1.ActiveRowScrollRegion Dim csr As ColScrollRegion = Me.ultraGrid1.ActiveColScrollRegion Dim contexts As Object() = New Object() {rsr, csr, cell} ' Get the ui element associated with the cell. Dim cellElem As CellUIElement = DirectCast(Me.ultraGrid1.DisplayLayout.UIElement.GetDescendant(GetType(CellUIElement), contexts), CellUIElement) If Not Nothing Is cellElem Then ' Write out the cell's location in the UltraGrid. Dim cellBounds As Rectangle = cellElem.Rect Debug.WriteLine("Cell's bounds in the UltraGrid are " & cellBounds.ToString()) Else ' If there is no ui element associated with the cell, then the cell is not visible. Debug.WriteLine("Cell is not visible in the UltraGrid.") End If Else Debug.WriteLine("There is no active cell.") End If End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; private void button56_Click(object sender, System.EventArgs e) { // Get the cell you want to get the location of. UltraGridCell cell = this.ultraGrid1.ActiveCell; if ( null != cell ) { // If there are multiple scroll regions, then we have to specify which scroll region to // get the ui element in. A cell could be visible in multiple places if you had split the // grid in two or more scroll regions. Intersection of ActiveRowScrollRegion and the // ActiveColScrollRegion make up the active scroll region which is where the edit control // would be positioned by the UltraGrid for editing the cell's contents if the cell were // in edit mode. RowScrollRegion rsr = this.ultraGrid1.ActiveRowScrollRegion; ColScrollRegion csr = this.ultraGrid1.ActiveColScrollRegion; object[] contexts = new object[] { rsr, csr, cell }; // Get the ui element associated with the cell. CellUIElement cellElem = (CellUIElement)this.ultraGrid1.DisplayLayout.UIElement.GetDescendant( typeof( CellUIElement ), contexts ); if ( null != cellElem ) { // Write out the cell's location in the UltraGrid. Rectangle cellBounds = cellElem.Rect; Debug.WriteLine( "Cell's bounds in the UltraGrid are " + cellBounds.ToString( ) ); } else { // If there is no ui element associated with the cell, then the cell is not visible. Debug.WriteLine( "Cell is not visible in the UltraGrid." ); } } else { Debug.WriteLine( "There is no active cell." ); } }