Hi to all, I've search here if some one have any idea to know if a UG showns any ScrollBar. With xamDataGrid there is a property that expose related info, but UltraGrid have not.
I wrote a static method wich may be do this work:
The code search in the UIElements of UG if there are the UIElements of ScrollBars ;)
Mind the gap!! the code check ONLY the first RowColRegion, if you have a splitted UG change the code to check desidered RowColRegion (R,C).
I hope this help.
Have a nice sunday.Davide Dolla.
Hey Davide great code - thanks for that. I have taken it further so that it can be used as an extender method under VB 2008 and have also taken advantage of Microsoft ScollBars enumeration as follows:
Imports System.Runtime.CompilerServicesImports Infragistics.Win.UltraWinGridPublic Module modUltraGridExtenders ''' <summary> ''' Determine if either or both of the scrollbars are visible on this UltraGrid control. ''' </summary> ''' <param name="gridControl">The UltraGrid in question.</param> ''' <returns>0 if none are visible; 1 if only the Horizontal scrollbar is visible; 2 if only the Vertical scrollbar is visible; or 3 if both scrollbars are visible.</returns> ''' <remarks></remarks> <Extension()> _ Public Function ScrollBarVisibility(ByVal gridControl As UltraGrid) As System.Windows.Forms.ScrollBars Dim r As Integer = 0 If gridControl.DisplayLayout.ColScrollRegions.Count > 0 AndAlso gridControl.DisplayLayout.RowScrollRegions.Count > 0 Then Dim uiCSR As RowColRegionIntersectionUIElement = gridControl.DisplayLayout.ColScrollRegions(0).GetUIElement(gridControl.DisplayLayout.RowScrollRegions(0)) Dim o As Object = uiCSR.Parent.GetDescendant(GetType(ColScrollbarUIElement)) Dim uiCScrollbar As ColScrollbarUIElement = TryCast(o, ColScrollbarUIElement) If uiCScrollbar IsNot Nothing Then r += 1 End If o = uiCSR.Parent.GetDescendant(GetType(RowScrollbarUIElement)) Dim uiRScrollbar As RowScrollbarUIElement = TryCast(o, RowScrollbarUIElement) If uiRScrollbar IsNot Nothing Then r += 2 End If End If Return CType(r, System.Windows.Forms.ScrollBars) End FunctionEnd Module