How to use transparent pictures and labels in Windows Forms

Source: Internet
Author: User

This article supporting source code

Yesterday a friend asked the Windows Form in the picture transparent problem, just look at the Internet, saw this article on the CodeProject, feel that write well, moreover oneself always want to learn translation technology articles, so it translated into Chinese, hope to bring some help.

Affirmation: The first translation of such articles, is a debut, inevitably have the wrong place, you are welcome to Pat brick Advice! ^_^

OK, start the body ...

Introduction-Windows Forms without transparency

If you make a complex form that includes pictures and labels, you may find that Windows Forms do not support real transparency. You may have torn your scalp--but it's still not resolved!

Even if you use a transparency value on the BackColor property of a picture or label, the result is that you still find it impossible to make it transparent. So, what is this for? Why is it clearly set to transparent, but not transparent? What the hell is going on?

In fact, when you set the transparency value on the BackColor property to control it, just set its background to the same background as the parent form--windows form, and there is no real transparency! So when they overlap, you will still find that they are not transparent to each other, as shown in the following figure:

In this article, we'll show you a simple way to make the tag's back picture as a background and how to make the picture and text truly transparent.

How to make transparent labels

Is it really easy to make a picture appear as a background with labels or text in front of it?

In the following, we will explain how to make the label background transparent.

There are two ways you can use it to label the background transparently (in fact there are more ways to do this, but we're just going to talk about simpler):

1. By setting the BackgroundImage property of the panel and placing the label lable inside it

2. Sets the lable parent form to PictureBox (label.parent = PictureBox)

In this way, we will not need to write any code, and we can immediately see the effect of its transparency in the designer:

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.