Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do a background for a label will be without color?

Tags:

c#

winforms

I want to add a label to my form , and I want it without any color- I want just it's text to be visible, I don't find this option in the label's properties, can anyone help me please?

like image 953
Shira Avatar asked Jan 09 '11 13:01

Shira


People also ask

How do I change the background color of a label?

To change the label's base background color, right click on a label against a patterned background, and select your choice from the Label Background menu. The Colored option will color the label background to match the dominant color in the pattern.

Which property do we need to set if we want to change background color of label control?

Following steps are used to set the BackColor property of the Label: Step 1: Create a label using the Label() constructor is provided by the Label class. // Creating label using Label class Label mylab = new Label(); Step 2: After creating Label, set the BackColor property of the Label provided by the Label class.


1 Answers

Do you want to make the label (except for the text) transparent? Windows Forms (I assume WinForms - is this true) doesn't really support transparency. The easiest way, sometimes, is Label's Backcolor to Transparent.

label1.BackColor = System.Drawing.Color.Transparent; 

You will run into problems though, as WinForms really doesn't properly support transparency. Otherwise, see here:

http://www.doogal.co.uk/transparent.php

http://www.codeproject.com/KB/dotnet/transparent_controls_net.aspx

http://www.daniweb.com/code/snippet216425.html

Setting the parent of a usercontrol prevents it from being transparent

Good luck!

like image 112
niemiro Avatar answered Sep 22 '22 03:09

niemiro