C ++ Builder custom system menu

zhaozj2021-02-17  63

Learning C Builder is really very few, the following is learned from a book, I don't know if you have help, take it out to give you a look:

Usually in the main form of the application, use the left mouse button to click the icon in the upper left corner, and a menu will pop up, called the System Menu. There is no component corresponding to the system menu in the form, so sometimes we need to customize the system menu. Specific can be achieved by the following steps:. Add the desired menu item on the system menu. Define the processing of the onclick event for the newly added menu item. In the following routine, a "front-end display (a)" menu item is added to the system menu, and the form is always displayed at the foremost end or is a normal form mode. The specific implementation process is as follows: 1) Create a new project by menu File | New Application. 2) The process of adding the form of the onclick event is as follows:

Void _fastcall tform1 :: formcall (TOBJECT * Sender) {// Settings System Menu Appendmenu (GetSystemMenu (Handle, False), MF_SEPARATOR, 0, ""); Appendmenu (GetSystemMenu (Handle, False), MF_STRING, 200, "front end display (& A) ");

3) Increase the following statement in the file unit1.h header file: ... # include ... 4) In the Type of TFORM1, add the process of processing the new menu item in the system menu. Disclaimer: ... public: // user declarations __fast * Owner; Message Void __fastcall systemmenucommand (twmmenuselect & msg);

Begin_Message_Map Message_Handler (WM_SysCommand, TwMMenUselect, SystemMand); END_MESSAGE_MAP (TFORM);

5) The processing of the onclick event for the new menu item in the manually adding system menu is as follows:

转载请注明原文地址:https://www.9cbs.com/read-29997.html

New Post(0)