Sorry,
that didn't the trick...
I use the following code:
Private Sub grdMailOverViewSyncFusion_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles grdMailOverViewSyncFusion.Resize
SetGridSizes()
End Sub
Private Sub grdMailOverViewSyncFusion_CurrentCellActivating(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridCurrentCellActivatingEventArgs) Handles grdMailOverViewSyncFusion.CurrentCellActivating
e.ColIndex = 0
End Sub
Private Sub grdMailOverViewSyncFusion_CurrentCellMoving(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridCurrentCellMovingEventArgs) Handles grdMailOverViewSyncFusion.CurrentCellMoving
Dim Range As Syncfusion.Windows.Forms.Grid.GridRangeInfo
Range = Syncfusion.Windows.Forms.Grid.GridRangeInfo.Cells(e.RowIndex, 1, e.RowIndex, 1)
DisplayMail(CStr(grdMailOverViewSyncFusion.DataBoundGridModel.GetCellsInfo(Range)(0).Text))
e.ColIndex = 0
End Sub
Private Sub InitializeGrid()
AddHandler grdMailOverViewSyncFusion.Model.SelectionChanging, AddressOf SelectionChanging
AddHandler grdMailOverViewSyncFusion.DataBoundGridModel.QueryCellInfo, AddressOf QueryCellInfo
With grdMailOverViewSyncFusion
.Refresh()
.AllowSelection = Syncfusion.Windows.Forms.Grid.GridSelectionFlags.Row Or Syncfusion.Windows.Forms.Grid.GridSelectionFlags.Shift Or Syncfusion.Windows.Forms.Grid.GridSelectionFlags.Multiple
.HScrollBehavior = Syncfusion.Windows.Forms.Grid.GridScrollbarMode.Disabled
.ResizeRowsBehavior = Syncfusion.Windows.Forms.Grid.GridResizeCellsBehavior.None
.ResizeColsBehavior = Syncfusion.Windows.Forms.Grid.GridResizeCellsBehavior.ResizeSingle
.ListBoxSelectionMode = Windows.Forms.SelectionMode.MultiExtended
.TableStyle.Borders.Bottom = New Syncfusion.Windows.Forms.Grid.GridBorder(Syncfusion.Windows.Forms.Grid.GridBorderStyle.None)
.TableStyle.Borders.Top = New Syncfusion.Windows.Forms.Grid.GridBorder(Syncfusion.Windows.Forms.Grid.GridBorderStyle.None)
.TableStyle.Borders.Left = New Syncfusion.Windows.Forms.Grid.GridBorder(Syncfusion.Windows.Forms.Grid.GridBorderStyle.None)
.TableStyle.Borders.Right = New Syncfusion.Windows.Forms.Grid.GridBorder(Syncfusion.Windows.Forms.Grid.GridBorderStyle.None)
End With
End Sub
Private Sub QueryCellInfo(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventArgs)
On Error Resume Next
If e.RowIndex > 0 AndAlso e.ColIndex > 0 Then
If e.RowIndex Mod 2 = 0 Then
e.Style.BackColor = System.Drawing.Color.Silver
e.Handled = True
End If
If e.ColIndex = 3 Then
e.Style.CellType = "System.Drawing.Image"
If CBool(e.Style.CellValue) = True Then
e.Style.Font.Bold = True
e.Style.ImageList = imlGrid
e.Style.ImageIndex = 1
Else
e.Style.Font.Bold = False
e.Style.ImageList = imlGrid
e.Style.ImageIndex = 2
End If
e.Handled = True
End If
If e.ColIndex = 2 Then
e.Style.CellType = "System.Drawing.Image"
If CBool(e.Style.CellValue) = True Then
e.Style.ImageList = imlGrid
e.Style.ImageIndex = 0
Else
e.Style.CellValue = ""
End If
e.Handled = True
End If
End If
End Sub
Private Sub SelectionChanging(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridSelectionChangingEventArgs)
If grdMailOverViewSyncFusion.MouseButtons = Windows.Forms.MouseButtons.Right Then
e.Cancel = True
End If
End Sub
is there any other way to keep the selection if right mousebutton is clicked?
Thanks, Jens
[email protected]
> Try handling the grid.Model.SelectionsChanging event and cancel it if the right button is down.
> ...