This repository has been archived by the owner on Sep 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Form1.vb
67 lines (62 loc) · 1.99 KB
/
Form1.vb
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
57
58
59
60
61
62
63
64
65
66
67
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Linq
Imports System.Text
Imports System.Windows.Forms
Imports DevExpress.XtraGrid.Views.Grid
Namespace IsFullExpandedOrCollapsed
Partial Public Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
Dim TempXViewsPrinting As DevExpress.XtraGrid.Design.XViewsPrinting = New DevExpress.XtraGrid.Design.XViewsPrinting(gridControl1)
gridView1.Columns("Discontinued").Group()
gridView1.Columns("Category").Group()
gridView1.OptionsView.NewItemRowPosition = NewItemRowPosition.Bottom
gridView1.OptionsView.ShowAutoFilterRow = True
End Sub
Private Function IsFullExpanded(ByVal view As GridView) As Boolean
If view.GroupCount = 0 Then
Return True
End If
If view.DataRowCount = 0 Then
Return True
End If
For i As Integer = -1 To Integer.MinValue + 1 Step -1
If (Not view.IsValidRowHandle(i)) Then
Return True
End If
If view.IsGroupRow(i) AndAlso (Not view.GetRowExpanded(i)) Then
Return False
End If
Next i
Return True
End Function
Private Function IsFullCollapsed(ByVal view As GridView) As Boolean
If view.GroupCount = 0 Then
Return False
End If
If view.DataRowCount = 0 Then
Return False
End If
For i As Integer = -1 To Integer.MinValue + 1 Step -1
If (Not view.IsValidRowHandle(i)) Then
Return True
End If
If view.IsGroupRow(i) AndAlso view.GetRowExpanded(i) Then
Return False
End If
Next i
Return True
End Function
Private Sub simpleButton1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles simpleButton1.Click
MessageBox.Show(String.Format("Fully exapanded: {0}" & Constants.vbLf & "Fully collapsed: {1}", IsFullExpanded(gridView1), IsFullCollapsed(gridView1)))
End Sub
End Class
End Namespace