C # Form loading and control loading out of sync cause controls to blink

Source: Internet
Author: User

Control flicker caused by form loading and non-synchronization of control loading:
Code blocks are added anywhere in the parent form to resolve control flicker issues caused by form loading and control loading not synchronizing
protected override CreateParams CreateParams
{
Get
{
CreateParams CP = base. CreateParams;
Cp. ExStyle |= 0x02000000;
return CP;
}
}

The principle is simple, quoting the following words:
A form that has a lot of controls takes a long time to paint. Especially the Button control in it default style is expensive.
Once get over the controls, it starts getting noticeable. The Form class paints its background first and leaves "holes" where the controls need to go.
Those holes is usually white, black is the use of the Opacity or TransparencyKey property. Then all control gets painted, filling in the holes.
The visual effect is ugly and there's no ready solution for it in Windows Forms. Double-buffering can ' t solve it as it works for a single control and not a composite set of controls.
I discovered a new Windows style in the SDK headers files, available for Windows XP and (presumably) Vista:ws_ex_composite D.
With this style turned on for your form, Windows XP does double-buffering on the form and all its child controls.

C # Form loading and control loading out of sync cause controls to blink

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.