Realization of merry-go effect under WinForm

Source: Internet
Author: User

The recent need to implement a merry-go effect in the WinForm project, the beginning of a number of methods such as mobile label control, the effect is always not very good, moving text always has a flicker phenomenon. Later found a foreign open source control, applied a bit, the effect is not bad. Carefully read the code, found that there are some areas worth improving, and now put the code and changes to the description, and share with you.

Source of Control: http://www.codeproject.com/KB/miscctrl/ScrollingTextControlArtic.aspx

My changes:

1, the DoubleBuffer setting

This is used in the original code. SetStyle (Controlstyles.doublebuffer, true); But some netizens have reflected that this sign is not valid for. NET 2.0 version. To tell you the truth, I'm not particularly sure that MSDN doesn't say that. In my. NET 2.0 system, the effects of the two settings do not seem to be much different. On a foreign website to find their differences, the following is the original:

ControlStyles = CS

AllPaintingInWmPaint = = APWMP

Optimizeddoublebuffer = ODB

DoubleBuffer = DB

An earlier permutation of the "design called" for ODB to simply is a combinationof DB, APWMP and UserPaint. Through several design changes, the two control styles are, nearly synonymous, but, they still have. Now so we ' ve broken that and we may considerun-deprecating CS. DB to retain. Here's a more complete summary of the:

Mechanism Side effects Other flags required to work Require apwmp? Notes
ControlStyle

. Db
None APWMP, UserPaint Yes We are considering not deprecating this flag because ODB ' t a isn for DB.
ControlStyle

. ODB
None None No Works, but without apwmp set for you ' ll-buffer foreground and background separately and'll still the flicker.
Control

. DoubleBuffered
Sets CS. ODB, CS. Apwmp None No Works for most mainstream buffering needs. The Getter is peculiar the it only checks CS. ODB.

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.