The main form has two processes: 1. When the main form is minimized, the floating window displays the code: Code Void MainFormSizeChanged (object sender, EventArgs e)
{
If (this. WindowState = FormWindowState. Minimized)
{
TopMostForm. Show ();
This. ShowInTaskbar = false;
}
Else if (this. WindowState! = Previusestate)
{
Previusestate = this. WindowState;
}
}
2. Restore the Main Window
/// <Summary>
/// Restore the Main Window
/// </Summary>
Public void RestoreWindowState ()
{
This. WindowState = previusestate;
This. ShowInTaskbar = true;
}
Floating window processing:
1. Set the window status to None to remove the border of the form.
This. FormBorderStyle = System. Windows. Forms. FormBorderStyle. None;
2. In the Load event, the highlight is to set the window transparency.
Code:
/// <Summary>
/// Transparent settings
/// </Summary>
Private void SetClarity (double prameter)
{
This. Opacity = prameter;
}
3. Hover window events:
Code:
Code Void TopMostFormMouseDown (object sender, MouseEventArgs e)
{
If (e. Button = MouseButtons. Left)
{
BlnMouseDown = true;
// Save the current, mouse, and window
PtMouseCurrrnetPos = Control. MousePosition;
PtFormPos = Location;
}
}
Void TopMostFormMouseUp (object sender, MouseEventArgs e)
{
If (e. Button = MouseButtons. Left)
{
BlnMouseDown = false;
}
}
Void TopMostFormMouseMove (object sender, MouseEventArgs e)
{
If (blnMouseDown)
{
// Obtain the current mouse position
PtMouseNewPos = Control. MousePosition;
// Set the window position
PtFormNewPos. X = ptMouseNewPos. X-ptMouseCurrrnetPos. X + ptFormPos. X;
PtFormNewPos. Y = ptMouseNewPos. Y-ptMouseCurrrnetPos. Y + ptFormPos. Y;
// Set the window position
Location = ptFormNewPos;
PtFormPos = ptFormNewPos;
// Save the mouse position
PtMouseCurrrnetPos = ptMouseNewPos;
}
}
4. Convert the functions of the main window:
Code:
Void TopMostFormDoubleClick (object sender, EventArgs e)
{
SwitchToMainForm ();
}
Void SwitchToMainForm ()
{
This. mainForm. RestoreWindowState ();
This. Hide ();
}
/Files/csharponworking/FlashFormDemos.zip