Example of a transparent bitmap class

Source: Internet
Author: User
Tags transparent color

Write a simple transparent bitmap class, sometimes for the program to Polish a lot of the following is a program I wrote the UI, personally feel quite interesting.

Figure One appearance

This class can be inserted into any program, it provides a unified interface, the interface function to receive the image of the resource index number, long, wide 3 parameters. Of course, you can also add a pointer parameter to the parent window to determine the object create behavior and to specify which parent window the image represents should be attached to.

Writing this class requires familiarity with the use of CRGN classes. Refer to MSDN for specific information, such as member functions Combinergn and SetWindowRgn.

So well, here's what we'll do to create this class step by step.

First, you have to prepare an image to be displayed on the UI, define a transparent color, use the color to fill the transparent part, note here, the transparent color should be the color of the image is the least, but also note that transparent and non-transparent junction must be clear, there can be no transition color. Here I am using RGB (255, 0,255). As follows:

Figure Two Transparent bitmap

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.