Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

Why DataGridView flickering when use in MDI chilform?

$
0
0

I have used the following code avoid the flickering issue issue for my controls but dataGridView alone getting flickering when moving that form inside of the MDI form.

Code

public Form2()
{
    InitializeComponent();
    this.PreventFlickering();
    this.IsMdiContainer = true;
}

protected override CreateParams CreateParams
{
    get
    {
        CreateParams cp = base.CreateParams;
        cp.ExStyle = cp.ExStyle | 33554432;
        return cp;
    }
}

private void PreventFlickering()
{
    this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
    this.SetStyle(ControlStyles.UserPaint, true);
    this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
    this.UpdateStyles();
}

private void button1_Click(object sender, EventArgs e)
{
    Form3 form = new Form3();
    form.MdiParent = this;
    form.Show();
}

Please let me know why am i getting this flickering issue. Then, how can i resolve this issue.

Thanks,


Mohanraj G


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>