取消左上角的關閉事件執行
privatevoidForm1_Closing(objectsender,System.ComponentModel.CancelEventArgse)
{
e.Cancel=true;
}
protectedoverridevoidOnClosing(CancelEventArgse)
this.ShowInTaskbar=false;
this.WindowState=FormWindowState.Minimized;
擴充套件資料
privateconstintCP_NOCLOSE_BUTTON=0x200;
protectedoverrideCreateParamsCreateParams
get
CreateParamsmyCp=base.CreateParams;
myCp.ClassStyle=myCp.ClassStyle|CP_NOCLOSE_BUTTON;
returnmyCp;
取消左上角的關閉事件執行
privatevoidForm1_Closing(objectsender,System.ComponentModel.CancelEventArgse)
{
e.Cancel=true;
}
protectedoverridevoidOnClosing(CancelEventArgse)
{
this.ShowInTaskbar=false;
this.WindowState=FormWindowState.Minimized;
e.Cancel=true;
}
擴充套件資料
privateconstintCP_NOCLOSE_BUTTON=0x200;
protectedoverrideCreateParamsCreateParams
{
get
{
CreateParamsmyCp=base.CreateParams;
myCp.ClassStyle=myCp.ClassStyle|CP_NOCLOSE_BUTTON;
returnmyCp;
}
}