This perheps is a strange question but if I have a buttoncontrol on the form I could programatically make this button invisible like below:

button1->Visible = false;

What I wonder is if it is possible to make the button Visible = false; by fading the button away so it disseapears slowly ? Perheps this is difficult to do and needs any specific libriaries.

The best way to do that is to use a visual trick.

Capture an image of the button. (You can do this by using GetWindowDC() on your form, then using BitBlt() to transfer the image of the button into a TImage canvas.)

Actually hide the button.

In your form paint, draw the image of the button. Every few score milliseconds or so adjust your image to have more of the form's background color and repaint.

There are a number of ways you can fade the colors of an image with another given color with the Win32 API or by directly manipulating the pixel data yourself...

Hope this helps.

Thanks. I think I could have found another approach to what I really want to do. Perheps this is easier.
What I want to do is to fade the whole Form down. I know that ::Opacity could be used for this.
I have tried to do some code that will fade the Form down to ::Opacity = 20 like this using this code inside a buttoncontrol.
When pressing the button, nothing happens. So I might wonder if this is possible to do in any way. If it is, this would be great :)

for(int i = 100; i = 20; i-= 0.01)
    {
	 Application::DoEvents();
	 Form4::Opacity = i;
    }

I found out that the values is between 0 and 1.00. So full Opacity is 1.00.
I am trying to "Fade In" a Form when this form is opened like below but are not sure
if this even is possible to do.
When open the Form, the Form is fully shown directly.

using namespace System::Threading;

virtual void OnActivated( EventArgs^ e ) override
{   
	this->Opacity = 0;
	for(double i = 0; i = 1; i+=0.01)
	{
		Application::DoEvents();
		 this->Opacity = i;
		 Thread::Sleep(100);
	}

}

I'm not a win32 programmer, so I might be wrong, but I think you have to refresh or draw the form each time you change the opacity .

[edit]
and your for-loop is wrong:

for(double i = 0; i = 1; i+=0.01)

I think you mean:

for(double i = 0.0; i != 1.0; i+=0.01)

Adding to what niek_e already mentioned, something like the following might be close to what you are after ...

for(double i = 0; i < 1.05; i += 0.05)
{
	this->Opacity = i;
	this->Refresh();
}

I am trying to "Fade In" a Form when this form is opened

Shouldn't it then be in the Form's Load event rather than in the Activated event?

>> Shouldn't it then be in the Form's Load event rather than in the Activated event?

Yes, that´s right ofcourse. I forgot myself : ). However I seemed to make it work with this method.
This is a nice effect that also takes ´flickering´ of the controls away as it happnens when the form is invisible.
Thanks...

Adding to what niek_e already mentioned, something like the following might be close to what you are after ...

for(double i = 0; i < 1.05; i += 0.05)
{
	this->Opacity = i;
	this->Refresh();
}

Shouldn't it then be in the Form's Load event rather than in the Activated event?

This question has already been answered. Start a new discussion instead.