Button button

zhaozj2021-02-16  52

Button button above. I saw an article in CodeGuru to explore how to put a button on the button. The practice is very simple, just inherit a CButton class, overload the PresubClassWindow function and the oncommand function in this class, add a private CButton class M_Buttonin, in PRESUBCLASSWINDOW, call m_buttonin's CREATE function, generate the button. These are very understandable. Why is it to overcome the oncommand function? We often see the overcommand function overcommand function in the dialog class, handle messages from child controls. The current situation is actually very similar, different is, usually the dialog box to change the adult buttons, but the button in the MFC is actually the window class. So it can also overload the oncommand function to process the message that the button inside is pressed. In OnCommand, you can handle your button to press the event or send a message to the dialog. In the button, the button does not know what practical use, but I think this problem can actually be trained to master the principles of Windows control message processing. This is probably a common problem for programming! Articles in CodeGuru link to http://www.codeguru.com/buttonctrl/double_button.shtml

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

New Post(0)