自定义系统菜单
procedure SysMenuCommand(var Msg:TWMMENUSELECT);message WM_SYSCOMMAND;procedure TFormMain.SysMenuCommand(var Msg: TWMMenuSelect);
begincase Msg.IDItem of0:beginMessageBox(0,PChar('茶杯'),'操作提示',MB_OK+MB_ICONINFORMATION);end;1:beginMessageBox(0,PChar('書本'),'操作提示',MB_OK+MB_ICONINFORMATION);end;2:beginMessageBox(0,PChar('Notice'),'操作提示',MB_OK+MB_ICONINFORMATION);end;3:beginMessageBox(0,PChar('Next'),'操作提示',MB_OK+MB_ICONINFORMATION);end;end;Inherited;
end;procedure TFormMain.FormCreate(Sender: TObject);mybit:=TBitmap.Create;mybit.LoadFromFile('F:\1.bmp');Self.Brush.Bitmap:=mybit;Self.Invalidate;
end;procedure TFormMain.FormShow(Sender: TObject);
varhSysMenu:hMENU;i:integer;
beginhSysMenu:=GetSystemMenu(Handle,False);//得到系統菜單句柄//通過位置刪除for i := 0 to 9 doDeleteMenu(hSysMenu, 0, MF_BYPOSITION);//通過命令刪除{DeleteMenu(hSysMenu, SC_TASKLIST, MF_BYCOMMAND);DeleteMenu(hSysMenu, SC_CLOSE, MF_BYCOMMAND);DeleteMenu(hSysMenu, SC_MOVE, MF_BYCOMMAND);DeleteMenu(hSysMenu, SC_MAXIMIZE, MF_BYCOMMAND);DeleteMenu(hSysMenu, SC_MINIMIZE, MF_BYCOMMAND);DeleteMenu(hSysMenu, SC_SIZE, MF_BYCOMMAND);DeleteMenu(hSysMenu, SC_RESTORE, MF_BYCOMMAND); }//添加新命令AppendMenu(hSysMenu,MF_STRING and MF_BITMAP,0,'茶杯');AppendMenu(hSysMenu,MF_STRING,1,'書本');AppendMenu(hSysMenu,MF_STRING,2,'Notice');AppendMenu(hSysMenu,MF_STRING,3,'Next');//菜單右對齊ModifyMenu(Menu.Handle,1,MF_BYPOSITION or MF_HELP,N2.Handle,PChar(N2.Caption));
end;
?
轉載于:https://www.cnblogs.com/tk-del/archive/2012/06/21/2557231.html
總結
- 上一篇: iOS CoreAnimation
- 下一篇: 开机显示c:\windows\windo