How to change the Properties of a Button at runtime?
Submitted by: AdministratorAssuming that you have set the button's ID as IDC_BTNSAMPLE in the resource editor :-
We have to use the ModifyStyle Function to do this. The function is defined as follows :-
CButton *pBtnSample = (CButton *)GetDlgItem(IDC_BTNSAMPLE); // Make the button look like a checkbox
pBtnSample->ModifyStyle(0,BS_AUTOCHECKBOX,SWP_FRAMECHANGED); // Remove the checkbox style and make it again normal
pBtnSample->ModifyStyle(BS_AUTOCHECKBOX,0,SWP_FRAMECHANGED);
Submitted by: Administrator
We have to use the ModifyStyle Function to do this. The function is defined as follows :-
CButton *pBtnSample = (CButton *)GetDlgItem(IDC_BTNSAMPLE); // Make the button look like a checkbox
pBtnSample->ModifyStyle(0,BS_AUTOCHECKBOX,SWP_FRAMECHANGED); // Remove the checkbox style and make it again normal
pBtnSample->ModifyStyle(BS_AUTOCHECKBOX,0,SWP_FRAMECHANGED);
Submitted by: Administrator
Read Online Visual C++ Job Interview Questions And Answers
Top Visual C++ Questions
☺ | How to Enable and Disable CButton at runtime? |
☺ | How to change the Text of a CButton at Runtime? |
☺ | What is command routing in VC++? |
☺ | How to change the Mouse Pointer Over a Button at runtime? |
☺ | How to change the position of Button at runtime? |
Top Coding/Programming Categories
☺ | Python Interview Questions. |
☺ | OOP Interview Questions. |
☺ | Software engineering Interview Questions. |
☺ | PHP Interview Questions. |
☺ | VBA (Visual Basic for Applications) Interview Questions. |