+ Reply to Thread
Results 1 to 2 of 2

Thread: Reduce the Form Flicker

  1. #1

    Reduce the Form Flicker

    Many of you if you are using specially .net FrameWork2 or any other framework and creating design for your application , you will face a really annoying issue and that is the Form Flickers , is there any solution for that ?
    I would like to create a basic design but the form flickering is so annoying.
    Last edited by csharpmaster; 11-09-2012 at 12:05 AM.

  2. #2
    Junior Member
    Join Date
    May 2012
    Posts
    36
    The old solution is located HERE and it works MORE than awesome.
    But there is an edit for it to work better :
    Code:
            int originalExStyle = -1;
            bool enableFormLevelDoubleBuffering = true;
    
            protected override CreateParams CreateParams
            {
                get
                {
                    if (originalExStyle == -1)
                        originalExStyle = base.CreateParams.ExStyle;
    
                    CreateParams cp = base.CreateParams;
                    if (enableFormLevelDoubleBuffering)
                        cp.ExStyle |= 0x02000000;   // WS_EX_COMPOSITED
                    else
                        cp.ExStyle = originalExStyle;
    
                    return cp;
                }
            }
    But if you still got a little flicker issue then you can place that snippet right After the InitializeComponent();
    Code:
                this.SetStyle(ControlStyles.UserPaint, true);
                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);

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts