Open MSVC# and create a new windows application
From your toolbox add
- 3 buttons
In the properties of each button, change the names respectively
Button1 Name = Hide
Button2 Name = UnHide
Button3 Name = Exit
Note: For quick keys, you can add the '&' symbol infront of a character in the CAPTION of the button which will allow Alt + key (where key is the character after the '&' Symbol)
Example:
Button1 Caption = &Hide
Button2 Caption = &Unhide
Button3 Caption = E&xit
This will allow the user to press alt + H to hide the form, Alt + U To Unhide the form and Alt + X to exit the application.
Now change the form's FormBorderStyle propertie to "None"
This will remove the border from the form.
You can do it by selecting the main form and chosing it from the properties, or you can do it by making your applications 'public Form1()' look like this:
Code:
public Form1()
{
this.FormBorderStyle = FormBorderStyle.None;
InitializeComponent();
}
Now that that is out of the way, double click each of your buttons in the form editor to have MSVC# generate the ButtonName_OnClick event for you.
Code:
private void Hide_Click(object sender, EventArgs e)
{
}
private void Unhide_Click(object sender, EventArgs e)
{
}
private void Exit_Click(object sender, EventArgs e)
{
}
Now add the following code to your Hide button's OnClick event:
Code:
TransparencyKey = BackColor;
The code below goes in your Unhide button's OnClick event:
Code:
TransparencyKey = Color.White;
And the final piece of code goes in the Exit button's OnClick event:
That's it, it's that simple.
Credits go to:
tremaster
NextGen1
Attached is the sample project