You must Sign In to post a response.
  • Category: Windows

    After Scrolling vertically datagridview repaints and flicker

    Hi All,

    I have Developed a windows application which has datagridview . Through the query i am populating all the records in it. I have set the scroll bar property to true. but when i try to scroll , the datagridview flicker and repaints , not able to scroll smoothly .According to google for such problem we have to set doublebuffer to true and put a method for setstyle property also I did that but still my datagridview not able to respond when i try to scroll.
    Please Help me out in this ASAP !!!
  • #766744
    Hi

    can you share the code. where did you set scroll :-
    Datagridview or panel. Datagridview not support means you can use around the gridview drag and drop one panel then placed in your gridview placed in panel then set scroll and try them. Mostly scrolling work based on records .

    Name : Dotnet Developer-2015
    Email Id :kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #766752
    Since you haven't posted the code I am not sure you use DoubleBuffered property properly or not. I want you to check below sample code and see if you are doing it properly.

    http://www.csharp-examples.net/set-doublebuffered/
    http://www.codeproject.com/Articles/12870/Don-t-Flicker-Double-Buffer
    Also if this is not helping you to resolve the issue please post the code you are using.


    Regards,
    Asheej T K
    Microsoft MVP[ASP.NET/IIS]
    DotNetSpider MVM

  • #766786
    There are lot of problem exist in windows form for flicker
    here are some work around
    1. try to set 'DoubleBuffered' property of form to 'true' for all forms.
    2. paste below code snippet in each form, above page load

    protected override CreateParams CreateParams
    {
    get
    {
    CreateParams cp = base.CreateParams;
    cp.ExStyle |= 0x02000000; // WS_EX_COMPOSITED
    return cp;
    }
    }
    //and add below code in form constructor after ' InitializeComponent(); ' method
    // Enable double duffering to stop flickering.
    this.SetStyle(ControlStyles.DoubleBuffer, true);
    this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
    this.SetStyle(ControlStyles.UserPaint, true);
    this.SetStyle(ControlStyles.SupportsTransparentBackColor, false);
    this.SetStyle(ControlStyles.Opaque, false);
    this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
    this.SetStyle(ControlStyles.ResizeRedraw, true);

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #766794
    Please check this url your issue may get solved of reviewing this.

    http://www.dotnetspider.com/resources/46202-Multilayered-Columns-in-Windows-Applications.aspx

    SRI RAMA PHANI BHUSHAN KAMBHAMPATI

  • #766795

    void dgvprdgrp_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
    {

    if (e.RowIndex == -1 && e.ColumnIndex > -1)
    {

    e.PaintBackground(e.CellBounds, false);

    Rectangle r2 = e.CellBounds;

    r2.Y += e.CellBounds.Height / 2;

    r2.Height = e.CellBounds.Height / 2;

    e.PaintContent(r2);

    e.Handled = true;

    }

    }


    SRI RAMA PHANI BHUSHAN KAMBHAMPATI


Sign In to post your comments