Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
10287 | Jan 28,2004 05:30 PM UTC | Sep 24,2004 03:30 PM UTC | WinForms | 12 |
![]() |
Tags: GridControl |
Private Sub gridControl1_CellClick(sender As Object, e As GridCellClickEventArgs) ''check for ctl+click If(Control.ModifierKeys And Keys.Control) <> 0 Then Dim rangeList As GridRangeInfoList If Me.gridControl1.Selections.GetSelectedRanges(rangeList, False) Then Dim clickedCell As GridRangeInfo = Me.gridControl1.CurrentCell.RangeInfo Dim clickedCellCol As GridRangeInfo = GridRangeInfo.Col(Me.gridControl1.CurrentCell.ColIndex) Dim newCol As Boolean = True Dim range As GridRangeInfo For Each range In rangeList If range <> clickedCell And range.IntersectsWith(clickedCellCol) Then newCol = False Exit ForEach End If Next range If newCol Then Console.WriteLine("ctl+click into new column") End If End If End If End Sub ''gridControl1_CellClick
If newCol Then
GroupBox1.Enabled = False
Else
GroupBox1.Enabled = True
End If
So, in this case when it is not a new column, you explicitly enable the groupbox which is what you see.
So, the question is: Exactly when do you want to enable the groupbox afer disabling it? It is not when you ctl-click into the same column which is what your code is dointg now, is it? Once you decide what this answer is, I think you would move the GroupBox1.Enabled = True to some other position in your code to implement what you need. >Private Sub gridControl1_CellClick(sender As Object, e As GridCellClickEventArgs) > ''check for ctl+click > If(Control.ModifierKeys And Keys.Control) <> 0 Then > > Dim rangeList As GridRangeInfoList > If Me.gridControl1.Selections.GetSelectedRanges(rangeList, False) Then > Dim clickedCell As GridRangeInfo = Me.gridControl1.CurrentCell.RangeInfo > Dim clickedCellCol As GridRangeInfo = GridRangeInfo.Col(Me.gridControl1.CurrentCell.ColIndex) > Dim newCol As Boolean = True > Dim range As GridRangeInfo > For Each range In rangeList > If range <> clickedCell And range.IntersectsWith(clickedCellCol) Then > newCol = False > Exit ForEach > End If > Next range > If newCol Then > Console.WriteLine("ctl+click into new column") > End If > End If > End If >End Sub ''gridControl1_CellClick >
gridControl1.SelectionChanged += new GridSelectionChangedEventHandler(gridControl1_SelectionChanged);
Then you handler will be called. In the sample you sent the event handler was not wired up at all.
Stefan
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.