How can you stop a C1.Win.C1FlexGrid grid from scrolling in window?

762 Views Asked by At

I have C1FlexGrid grid in windowform, then scroll down so that the lower half of the grid is shown, then click on a control outside the grid, then click on a line in the grid, the grid scrolls up to the top and the wrong row in the grid is selected. the grid scroll happens before the events fire. I want to stop autoscroll when grid get focus.

Any suggestions?

2

There are 2 best solutions below

0
Chinh Nguyen On BEST ANSWER

I figure out in our custom grid control inherited from C1FlexGrid has a method OnEnter

public class FAGrid : C1FlexGrid
{
       public FAGrid();
       //
       protect override void  OnEnter(EventArgs e)
       {
         this.Select(1,1);
          base.OnEnter(e);
       }
}

This is a cause of strange behavior. I removed OnEnter method, it works. Thank you.

0
Chinh Nguyen On

Here is my grid's behavior: https://gifyu.com/image/nRtw

I add C1FlexGrid grid to form in form load event:

private void voucher_Load(object sender, EventArgs e) {

        voucherlib.voucherlib.ListGridDetails[0].Name = "grdCtDkList";
        this.grpCt1.Controls.Add(voucherlib.voucherlib.ListGridDetails[0]);
        voucherlib.voucherlib.ListGridDetails[0].Dock = DockStyle.Fill;
    }

I am using C1FlexGrid from ComponentOne for .NET 2.0