I've been having troubles in doing single line selections in WM6.5 on DataGrid control, does anyone find a way to go around this problem?
Thanks in advance
Printable View
I've been having troubles in doing single line selections in WM6.5 on DataGrid control, does anyone find a way to go around this problem?
Thanks in advance
Anyone?
This code might be used in my other thread about datagrid ClearSelection.
Finally i came across a possible answer, it's a very rude answer though, maybe someone will have a better idea for best performance at least.
vb Code:
Private Sub DataGridEntidades_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DataGridEntidades.MouseUp Try Dim arrRows As ArrayList = CType(DataGridEntidades.GetType().GetField("m_rlrow", BindingFlags.NonPublic Or BindingFlags.Static Or BindingFlags.Instance).GetValue(DataGridEntidades), ArrayList) Dim i As Integer If DataGridEntidades.CurrentRowIndex >= 0 Then For i = 0 To arrRows.Count - 1 Step 1 If i = DataGridEntidades.HitTest(e.X, e.Y).Row Then DataGridEntidades.CurrentRowIndex = i DataGridEntidades.Select(i) Else DataGridEntidades.UnSelect(i) End If Next Dim localPoint As New Point localPoint.X = MousePosition.X localPoint.Y = MousePosition.Y ContextMenu1.Show(Me, localPoint) End If Catch ex As Exception ' End Try End Sub
I guess that this code won't need any explanations since it's a quite simple way to deselect rows. Hopefully someone will turbocharge this code :p
Performance on:
WM6.5 Professional
Samsung Omnia I
DataGrid using custom columns
Using databinding with 3600 rows
Time to unselect all rows, select only one row and show the ContextMenu, took not more then 0.4 secs
Other hidden properties that can be used as well
Code:m_kcxDefaultColWidth, System.Int32
m_kfDefaultVScrollVisible, System.Boolean
m_kfDefaultHScrollVisible, System.Boolean
m_kfDefaultColumnHeadersVisible, System.Boolean
m_kfDefaultRowHeadersVisible, System.Boolean
v_xyDpi, System.Int32
v_cxDefaultWidth, System.Int32
v_cyDefaultHeight, System.Int32
v_cxyDefaultBorderWidth, System.Int32
v_cxyDefaultGridLineWidth, System.Int32
v_nDefaultTextInset, System.Int32
v_cxyDefaultResizePixel, System.Int32
v_cxDefaultRowHdrWidth, System.Int32
v_cxAutoGenColWidth, System.Int32
v_cxyMinRowColWidth, System.Int32
m_renderer, System.Windows.Forms.GridRenderer
m_tabstycol, System.Windows.Forms.GridTableStylesCollection
m_tabstyActive, System.Windows.Forms.DataGridTableStyle
m_objDataSource, System.Object
m_cmData, System.Windows.Forms.CurrencyManager
m_rlrow, System.Collections.ArrayList
m_pdcolData, System.ComponentModel.PropertyDescriptorCollection
m_fListHandlerActive, System.Boolean
m_irowVisibleFirst, System.Int32
m_irowVisibleLast, System.Int32
m_crowVisible, System.Int32
m_cyRow, System.Int32
m_prefferedRowHeight, System.Int32
m_fRowHeadersVis, System.Boolean
m_icolVisibleFirst, System.Int32
m_icolVisibleLast, System.Int32
m_ccolVisible, System.Int32
m_cyColumnHeader, System.Int32
m_fColHeadersVis, System.Boolean
m_fValidColsSet, System.Boolean
m_icolValidFirst, System.Int32
m_icolValidLast, System.Int32
m_curcell, System.Windows.Forms.DataGridCurrentCell
m_fColResizeActive, System.Boolean
m_fRowResizeActive, System.Boolean
m_irowcolResize, System.Int32
m_xyResizeCur, System.Int32
m_xyResizeLast, System.Int32
m_xyResizeMax, System.Int32
m_xyResizeMin, System.Int32
m_fRowSelectDragActive, System.Boolean
m_sbHorz, System.Windows.Forms.HScrollBar
m_sbVert, System.Windows.Forms.VScrollBar
m_yRenderLast, System.Int32
m_xRenderLast, System.Int32
CurrentCellChanged, System.EventHandler
m_hwn, System.IntPtr
m_gch, System.Runtime.InteropServices.GCHandle
m_wnt, Microsoft.AGL.Forms.WNT
m_thread, System.Threading.Thread
m_mnucOwned, System.Windows.Forms.ContextMenu
m_mnucFloating, System.Windows.Forms.ContextMenu
m_qutaskInvoke, System.Collections.Queue
m_dataBindings, System.Windows.Forms.ControlBindingsCollection
m_bindingContext, System.Windows.Forms.BindingContext
m_fDisposed, System.Boolean
m_fCalledDispose, System.Boolean
m_fDestroyed, System.Boolean
m_fEnabledReal, System.Boolean
m_objTag, System.Object
m_strName, System.String
m_cLayoutSuspend, System.Int32
m_fScrollableSav, System.Boolean
m_fMousePressed, System.Boolean
m_fFocusAttempt, System.Boolean
m_fSkipValidation, System.Boolean
m_bsRequiredScaling, System.Windows.Forms.BoundsSpecified
m_cSuspendValidation, System.Int16
m_fParentedOrOwned, System.Boolean
m_context, System.Windows.Forms.ApplicationThreadContext
m_rlctlChildren, System.Collections.ArrayList