Cbutton class create function usage

Source: Internet
Author: User

According to the msdn documentation, the parameter Meanings of the create function are as follows:

Virtual bool create (
Lpctstr lpszcaption,
DWORD dwstyle,
Const rect & rect,
Cwnd * pparentwnd,
Uint Nid
);

Lpszcaption

Specifies the text of the button control.

Dwstyle

Specifies the style of the button control. Applies to any combination of Button styles.

Rect

Specifies the size and position of the button control. It can beCrectObject orRectStructure.

Pparentwnd

Specifies the parent window of the button control, usuallyCdialog. Cannot beNull.

Nid

ID of the button control.

I mean the problem I encountered when using this function:

(1) The first parameter is the control text. On the internet, double quotation marks are directly used: "window". However, vs2013 will report an error. Just use text ("window ").

(2) create a cbutton object btn in the oncreate method and call BTN. create method creation button, run, you will find that the button is not displayed, why, because the BTN object we created is a local variable, when the oncreate method ends, BTN destructor, recycle window resources, and click destroy. Therefore, we need to define cbutton as a global variable.

(3) after calling the create method of BTN, you must call the showwindow method to display the button. You can use this method to add the ws_visible type to the second parameter of create.






Zookeeper

Cbutton class create function usage

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.