I have a label named label1. When the user clicks button1, my label becomes invisible:
label1.Visible = false;
What can I do to animate this property (for WinForms)?
You can modify the text colour of the label gradually between your Form's background colour (or transparent if it works) and the final colour.
Actually, WinForms does not support animations like WPF does.
You will have to use a custom solution. For example you can look into using GDI+.
Make a 'image' of the label (Example)
Set the visibility of the label to false.
Use GDI to draw the bitmap using less opacity to simulate the opacity fade.
Related
I want to create a colored border around a TextBox on a Windows Form, something like what can be done in Android (with the "ID" and "PackSize" EditText widgets):
Is this possible (without writing a gazillion LOC and sacrificing a chicken)?
There is a BorderStyle property, but that does not change the color of the border. The ForeColor and BackColor properties also do nothing helpful.
You could either:
Put the textbox in a slightly larger Panel with a dark BackColor or
Handle the Paint event and draw the border yourself.
I was wondering if I could draw the background of a tabpage in C# transparent like so I can see behind the window itself. I though it would give a cool effect but I don't know if or how I can do it.
You can set the Appearance property of TabControl to Buttons Instead of using BackColor property. That would bring transparent tab page look and cool effect.
VB & C# syntax
TabPage1.BackColor = Color.Transparent
this will show the tabpage1 color as the form color.
I have a form that I want to use with background, when I'm loading the background all my labels and richtexts still have as backcolor "Control", when I choose "Transparent" for the labels it's working, but when I choose it for the richtexts I', getting the error: "Control does not support transparent background colors."
How can I fix this?
NO you can't?
set TransparencyKey of window to control background color
setting this property will make this color transparent on whole window
use two windows overlapping each other one with background and another with your controls with transparency key
I want to make the background of a PictureBox control transparent. In the PictureBox (rectangular shape), I placed an icon (circular in shape). I want to make the icon transparent so that the other portion underneath the icon is visible.
I have tried setting the PictureBox.BackColor property to "Transparent", but it doesn't work. I also tried to set it during runtime with the Color.FromArgb method, but it doesn't work either.
Is there any solution to this problem?
Setting pictureBox.BackColor = Color.Transparent; definitely should work.
Also verify if you are setting alpha channel of color when using Color.FromArgb(0, 0, 0, 0); (this is a first parameter, zero means transparent color)
And, of course, make sure your icons have transparent background.
If using WinForms then Setting the background color to transparent won't work as transparency handling is not a cascading system - you can only (in most cases) set transparency (or rather the opacity) of a control overall using the Opacity property, however this will alter the alpha channel of the entire control display giving your images a see-througness.
One solution might be to set the background color of the PictureBox to be that of the control beneath it (the color of the form, for example). But this may not suffice in your situation.
hi you must set the icon on the other portion underneath the icon by using this
icon_pictureBox_name.Controls.Add(other_portion_picturBox_name);
and after that you can set the PictureBox.BackColor property to "Transparent" and it will work ;)
how to make any control of win application transparent. i want that i will assign a background image for the target control and will invoke a routine and that routine will create that control transparent in such a way that only image will visible. as a example suppose image has assign to picture box. the picture shape is not square rather irregular. if i can make picture box transparent then user will see the image only. basically i want to make a picture box or any control irregular shape. how to achieve it through code in c#.
thanks
In WPF, transparency is quasi for free. For the image-element, assign a png-image with an alpha mask and the image will be rendered with active transparency.
For controls with an solid background, you generally have to set the Background to a transparent Brush:
If you want to make a whole window partial transparent, you have to remove the border, set the window style to none, set the background brush to a transparent brush, and set the AllowsTransparency-property of the window to true.
there is one for ordinary winform at
http://www.youtube.com/watch?v=K_JzL4kzCoE