Click here to Skip to main content
15,843,137 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have 2 winforms, named: Form1.cs and StartScreen.cs

Form1.cs starts this way:

C#
public Form1()
        {
            StartScreen sc = new StartScreen();
            sc.ShowDialog();
            
            InitializeComponent();
        }



I have 3 timers on StartScreen.cs: fadein, show, fadeout. Everything works fine, but I have only one problem:

When the splash screen starts to fade OUT, it flickers once. I tried to find solution for this, but no success. StartScreen's TopMost property is set to true.

Program.cs looks like this default:

C#
static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
    }



Can somebody show me the magic code to disable this annoying flickers please? What should I change?

Thanks
Posted
Comments
Thava Rajan 28-Sep-15 3:35am    
try to use the optimized double buffer

1 solution

i am not sure what you are asking, but any way
the following link will help you
Setstyles[^]
use the double buffer option it will reduce the flickering,

but again it is purely depend on your code, i am just give a suggestion based on your question
 
Share this answer
 
Comments
DoomMaker79 29-Sep-15 1:43am    
Thanks a lot, this is the solution. I add this method to my StartScreen.cs and call it right before the InitializeComponent()

public void EnableDoubleBuffering()
{
this.SetStyle(ControlStyles.DoubleBuffer |
ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint,
true);
this.UpdateStyles();
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900