Posted 4 September 2023, 5:08 am EST
- Updated 4 September 2023, 5:13 am EST
Correction. It seems to work but If you continuously change the cursor position over the grid, after a few seconds I got the following error. (see screenshot 1)
Sometimes, error appears after 2 or 3 sec, sometimes I had to mouse the mouse for 15 sec or more before getting the error.
Note: I also add a screenshot for a problem that I have regularly (also with previous version. I sometimes display the record number in the fixed column. When you scroll with the mouse, it happens sometimes that some numbers are not drawn correctly. (Cells are blank)
Code used for the the OwnerDrawn is below. Just added the if (e.Style is { Name: “Hover” }) return to my current code.
private void c1FlexInstrument_OwnerDrawCell(object sender, OwnerDrawCellEventArgs e)
{
ShowRowNo((C1FlexGrid)sender, e);
}
private void ShowRowNo(C1FlexGrid flex, OwnerDrawCellEventArgs e)
{
**if (e.Style is { Name: "Hover" }) return;**
if (e.Row >= flex.Rows.Fixed && e.Col >= flex.Cols.Fixed)
flex.Rows[e.Row][0] = (e.Row - 1).ToString(CultureInfo.InvariantCulture).PadLeft(5, '0');
if (e.Row >= flex.Rows.Fixed && e.Col >= flex.Cols.Fixed)
e.Style = flex.Row == e.Row || flex.Rows[e.Row].Selected
? flex.Col == e.Col && flex.Row == e.Row
? flex.Styles["HighLightCell"]
: flex.Styles["HighLight"]
: flex.Styles["MyDefault"];
else e.Style = flex.Styles["Fixed"];
e.Handled = false;
}
Note: If I set the e.Handle to true then cells are not drawn
