Question

I'm a second year student, and our Faculty uses C# and the Windows Form environment to illustrate and demonstrate Programming Principles. However i teach myself c++ as far as i learn new C# code(Here it's good to know both).

I'm curious about something : thus far i have never had a problem with the time forms take to be contructed and drawn, but since i used a simple 1280x1024(4:3) image as the backround image of one of my forms, i'm very disapointed. Now to avoid the flickering of controls when the form first apears i did the following :

    protected override CreateParams CreateParams
    {
        get
        {
            CreateParams cp = base.CreateParams;
            cp.ExStyle |= 0x02000000;  // Turn on WS_EX_COMPOSITED
            return cp;
        }
    }

Link : How to fix the flickering in User controls

This solved the previous mention problem, however, now i have to wait up till 1.5 seconds(depending on the speed of the PC i'm running the exe on) before anything shows.

Does the fault lie in the way c# compiles, the WinForms environment, or is there some solution i just haven't tried.

Was it helpful?

Solution 2

i'm very disapointed

winforms is not recommended for any new projects. Only to maintain legacy applications.

It is not hardware accelerated, and is simply not designed for today's UI needs.

is there some solution i just haven't tried?

Microsoft Build Conference is going on right now and they're emphasizing a LOT on XAML-based UI technologies such as WPF and WinRT as the "present and future" of Windows UI Development.

Bottom line: forget winforms. It's useless and deprecated. It requires a bunch of horrible hacks to do anything and even with those hacks it does not offer even a small fraction of the results you can obtain from modern UI technogies. No one cares about it and Microsoft has put it in "maintenance mode" where they fix any critical bugs reported but will not add any features to it.

OTHER TIPS

Unfortunately, it's a hack (CreateParams), this is described here by a SO user

http://angryhacker.com/blog/archive/2010/07/21/how-to-get-rid-of-flicker-on-windows-forms-applications.aspx

so it's going to do some funny things, be slow, max/minimize buttons not work.

WPF is the way to go...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top