-
September 27th, 2019, 10:47 PM
#1
Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet
I have one Cpropertysheet which contains two Cproperty page.I am able to change the background color of page and sheet as well using onctlcolor() but i am not able to change background color of standard buttons (ok,cancel,help), i tried setfacecolor, dc.setbkcolor ,code is compiling successfully but nothing is reflecting the result.Please please provide the solution with a code snippet
-
September 28th, 2019, 12:46 AM
#2
Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet
Victor Nijegorodov
-
September 28th, 2019, 11:27 AM
#3
Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet
Yes victor i tried setfacecolor ,code is compiling but result is not reflected..please help me out
-
September 29th, 2019, 12:21 AM
#4
Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet
Please post the code you have to change the button color.
-
September 29th, 2019, 09:25 AM
#5
Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet
Code:
Bool MyPropertysheet :: OnInitDialog()
{
Bool bResult = Cpropertysheet :: OnInitDialog();
CMFCBUTTON * but1 = (CMFCBUTTON *)GetDlgItem(IDOK);
but1->MoveWindow(8,596,58,25) ;
CMFCBUTTON * but2 = (CMFCBUTTON *)GetDlgItem(IDHELP);
but2->MoveWindow(250,596,58,25) ;
CMFCBUTTON * but3 = (CMFCBUTTON *)GetDlgItem(IDCANCEL);
but3->MoveWindow(8,596,58,25) ;
// Above code is successfully moving the buttons position
m_ok.SetFaceColor(RGB(255,102,0);
/*m_ok has been declared of type CMFCBUTTON in header file of MyPropertysheet */
return bResult ;
}
Void MyPropertysheet ::DoDataExchange(CDataExchange* pDX)
{
Cpropertysheet:: DoDataExchange(pDX)
DDX_Control(pDX, IDOK, m_ok);
}
//DoDataExchange(CDataExchange* pDX) declared in header file of MyPropertysheet
Last edited by 2kaud; September 29th, 2019 at 10:42 AM.
Reason: Added code tags
-
September 29th, 2019, 12:26 PM
#6
Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet
Victor Nijegorodov
-
September 30th, 2019, 12:29 AM
#7
Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet
CMFCBUTTON is derived from CButton and provide setfacecolor() function to color background of button
-
September 30th, 2019, 01:40 AM
#8
Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet
Originally Posted by Sparsh_21j
CMFCBUTTON is derived from CButton and provide setfacecolor() function to color background of button
Who created this CMFCBUTTON class?
How is this setfacecolor() function implemented?
Victor Nijegorodov
-
September 30th, 2019, 03:54 PM
#9
Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet
CMFCBUTTON is a MFC class provided by miceosoft.i am just using it by including a header "afxbutton.h"
-
September 30th, 2019, 03:59 PM
#10
Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet
Originally Posted by Sparsh_21j
CMFCBUTTON is a MFC class provided by miceosoft.i am just using it by including a header "afxbutton.h"
MFC does NOT provide the CMFCBUTTON class. It does provide the CMFCButton class!
Last edited by VictorN; October 1st, 2019 at 02:28 AM.
Victor Nijegorodov
-
September 30th, 2019, 07:09 AM
#11
Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet
Originally Posted by Sparsh_21j
CMFCBUTTON is derived from CButton and provide setfacecolor() function to color background of button
There's an MFC class CMFCButton. Is that what you're using or did you create your own CMFCBUTTON class?
-
September 30th, 2019, 03:45 PM
#12
Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet
Yes you are right i am using MFC class provided by Microsoft
-
September 30th, 2019, 03:50 PM
#13
Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet
Originally Posted by Sparsh_21j
Yes you are right i am using MFC class provided by Microsoft
Then it must be either CMFCButton or some class derived from CMFCButton. Is your class CMFCBUTTON derived from CMFCButton class?
Victor Nijegorodov
-
September 29th, 2019, 01:53 PM
#14
Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet
What is m_ok? Where is it set?
-
September 30th, 2019, 12:27 AM
#15
Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet
m_ok has been there in DDX_Exchange() see..second last line of code.and m_ok has been declared in header file
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|