Player progress bar Design

Source: Internet
Author: User

I made a progress bar for the player and encountered a very serious problem during this period. Now I have recorded it for future study.

The progress bar uses the csliderctrl control. The csliderctrl control belongs to the scroll type and has the concept of page. The POS obtained when you click csliderctrl to locate and play is not prepared. This is because when you click csliderctrl to locate the page, the slider will slide the size of the page to the direction of the mouse, rather than positioning the position of the mouse.

The processing method is to intercept wm_lbuttondown and wm_lbuttonup events in the pretranslatemessage of the parent window.

Based on the coordinates of the parent window, the control coordinates and the mouse coordinates in the message, calculate the slider POs, and setpos slide the slider over.

When Calculating coordinates, you must consider that the channel in csliderctrl has a distance from the border. You must calculate this distance, otherwise POS is not accurate. You can use csliderctrl: getchannelrect to obtain the channel coordinate, and left is the distance.

To avoid page problems, you can discard the csliderctrl control and use cstatic to self-paint. This is a little more complicated.

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.