-
September 30th, 2019, 03:54 PM
#16
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:57 PM
#17
-
September 30th, 2019, 03:59 PM
#18
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, 11:55 PM
#19
Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet
Originally Posted by Sparsh_21j
I tried that too by using create() method but unfortunately my button was not displayed on Sheet.. and can you please tell with line of code what you want to say above "you may have to use <pointer to the property sheet>::GetDlgItem()."
How about you first try what I suggested? That is, put a button on one of the property pages and change its color.
When you get that to work, we can show you how to do the same for a button on the property sheet.
-
October 1st, 2019, 02:05 AM
#20
Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet
Its i think better to leave the loop.Please google CMFCBUTTON class you will find its a class provided by the Microsoft by just including a header afxbutton.h
-
October 1st, 2019, 02:10 AM
#21
Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet
Ok arjay i will try that.bdw i have one button there on property page already and i am able to change its background color using setfacecolor() .You want me to add one new button on this propertypage and change its background color.Right?
-
October 1st, 2019, 02:39 AM
#22
Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet
Originally Posted by Sparsh_21j
Its i think better to leave the loop.Please google CMFCBUTTON class you will find its a class provided by the Microsoft by just including a header afxbutton.h
Are you kidding?
It is the quote from Microsoft afxbutton.h file:
Code:
// This is a part of the Microsoft Foundation Classes C++ library.
// Copyright (C) Microsoft Corporation
// All rights reserved.
//
// This source code is only intended as a supplement to the
// Microsoft Foundation Classes Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Microsoft Foundation Classes product.
#pragma once
#include "afxcontrolbarutil.h"
#include "afxmenuimages.h"
#ifdef _AFX_PACKING
#pragma pack(push, _AFX_PACKING)
#endif
#ifdef _AFX_MINREBUILD
#pragma component(minrebuild, off)
#endif
/*============================================================================*/
// CMFCButton window
class CMFCButton : public CButton
{
DECLARE_DYNCREATE(CMFCButton)
// Construction
public:
CMFCButton();
// Attributes
There is a class CMFCButton, not CMFCBUTTON!
Or you don't know the difference between capital and small (upper-/lower-case) letters?
Victor Nijegorodov
-
October 1st, 2019, 04:16 AM
#23
Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet
Yes its CMFCButton but please i am here looking for solution ,please tell that.already told you code is compiling successfully but not reflecting result by using setfacecolor() .if you can help than plz tell asap coz i am stucking in one of GUI redesign
-
October 1st, 2019, 04:31 AM
#24
Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet
Originally Posted by Sparsh_21j
Yes its CMFCButton but please i am here looking for solution ,please tell that.already told you code is compiling successfully but not reflecting result by using setfacecolor() .if you can help than plz tell asap coz i am stucking in one of GUI redesign
Well, we could help you if you provided the meaningful info about what and how you tried
Note that "code" you have posted:
Originally Posted by Sparsh_21j
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
is not a real code.
What is Void?
What is Bool?
What is Cpropertysheet?
What is CMFCBUTTON ?
BTW, did you read the Microsoft Docs about CMFCButton::SetFaceColor (I posted you a link)?
Victor Nijegorodov
-
October 2nd, 2019, 02:57 PM
#25
Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet
Originally Posted by Sparsh_21j
Yes its CMFCButton but please i am here looking for solution ,please tell that.already told you code is compiling successfully but not reflecting result by using setfacecolor() .if you can help than plz tell asap coz i am stucking in one of GUI redesign
We're trying to help, but you need to post real code. Spelling matters and where you put the code matters. For example, when you attempt to change the color on m_ok, it may not be a valid variable at the time you try to change its color or it may not be mapped to the property sheet ok button.
-
October 3rd, 2019, 11:22 AM
#26
Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet
Bool is the return type of OnInitDialog() method // declared in header file i.e MyPropertysheet.h
Void is returne type of DoDataExchange() method //declared in header file i.e MyPropertysheet.h
//DoDataExchange() basically maps m_ok to IDOK
//m_ok is of type CMFCButton ,this is also declared in header file MyPropertysheet.h
//Cpropertysheet is nothing ,i have spelled it here wrong but in my code it is CpropertySheet i.e an MFC class
//CMFCBUTTON is nothing ,i have spelled it here wrong ,its CMFCButton in my code.
//Simple explanation is that i have one variable m_ok of type CMFCButton and m_ok is mapped to IDOK ,but when i am using m_ok.SetFaceColor(RGB(255,102,0),Code is compiling successfully but result is not reflected.
-
October 3rd, 2019, 11:52 AM
#27
Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet
Originally Posted by Sparsh_21j
Bool is the return type of OnInitDialog() method // declared in header file i.e MyPropertysheet.h
Void is returne type of DoDataExchange() method //declared in header file i.e MyPropertysheet.h
//DoDataExchange() basically maps m_ok to IDOK
//m_ok is of type CMFCButton ,this is also declared in header file MyPropertysheet.h
//Cpropertysheet is nothing ,i have spelled it here wrong but in my code it is CpropertySheet i.e an MFC class
//CMFCBUTTON is nothing ,i have spelled it here wrong ,its CMFCButton in my code.
//Simple explanation is that i have one variable m_ok of type CMFCButton and m_ok is mapped to IDOK ,but when i am using m_ok.SetFaceColor(RGB(255,102,0),Code is compiling successfully but result is not reflected.
You've been asked several times to post real code. Not sure why you'd retype a bunch of invalid code rather than copy and paste the real thing.
-
October 3rd, 2019, 03:40 PM
#28
Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet
Originally Posted by Sparsh_21j
Bool is the return type of OnInitDialog() method // declared in header file i.e MyPropertysheet.h
It is wrong!
OnInitDialog() mehod returns BOOL.
Originally Posted by Sparsh_21j
//m_ok is of type CMFCButton ,this is also declared in header file MyPropertysheet.h
//Cpropertysheet is nothing ,i have spelled it here wrong but in my code it is CpropertySheet i.e an MFC class
//CMFCBUTTON is nothing ,i have spelled it here wrong ,its CMFCButton in my code.
//Simple explanation is that i have one variable m_ok of type CMFCButton and m_ok is mapped to IDOK ,but when i am using m_ok.SetFaceColor(RGB(255,102,0),Code is compiling successfully but result is not reflected.
Just post your real code!
Victor Nijegorodov
-
October 3rd, 2019, 11:48 PM
#29
Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet
Originally Posted by Sparsh_21j
//Simple explanation is that i have one variable m_ok of type CMFCButton and m_ok is mapped to IDOK ,but when i am using m_ok.SetFaceColor(RGB(255,102,0),Code is compiling successfully but result is not reflected.
Yes. I said the variable may not be valid at the time you set the color - it depends on where you do this.
If you post your real code, we may be able to help.
-
October 7th, 2019, 04:29 AM
#30
Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet
Code:
//----------------------------------------------------------------//
//Below is the code for .cpp file
//----------------------------------------------------------------//
//MyPropertySheet.cpp
#include "stdafx.h"
#include "MyPropertysheet.h"
#include <ts/texttrans.h>
#include <ts/mfc/tsmfcwinstack.h>
IMPLEMENT_DYNAMIC(MyPropertysheet,CPropertySheet)
MyPropertySheet :: MyPropertySheet(UINT nIdCaption, Cwnd * pParentWnd, UINT iSelectPage): CPropertySheet(pszCaption, pParentWnd, iSelectpage)
{
TSMFCWinStack :: winStack.push(this);
AddPage(&mypage);
m_psh.dwFlags = m_psh.dwFlags | PSH_NOAPPLYNOW;
}
MyPropertySheet :: ~MyPropertySheet()
{
TSMFCWinStack :: winStack.pop(this);
}
Void MyPropertySheet:: DoDataExchange(CDataExchange* pDX)
{
CPropertySheet :: DoDataExchange(pDX);
DDX_Control(pDX, IDOK, m_ok);
}
BEGIN_MESSAGE_MAP(MyPropertySheet, CPropertySheet)
END_MESSAGE_MAP()
BOOL MyPropertysheet:: OnInitDialog()
{
BOOL bResult = CPropertySheet:: OnInitDialog();
m_ok.SetFaceColor(RGB(255,102,0);
SetDlgItemText(IDOK,("OKAY"));
return bResult;
}
Code:
//----------------------------------------------------------------//
//Below is the code for Header file
//----------------------------------------------------------------//
//MyPropertySheet.h
#include "MyPropertyPage.h"
#include "afxbutton.h"
class MyPropertySheet : public CPropertySheet
{
DECLARE_DYNAMIC(MyPropertySheet)
public:
//Constructors
MyPropertySheet(UINT nIdCaption, CWnd* pParentWnd = NULL ,UINT iSelectPage = 0);
MyPropertySheet(UINT pszCaption, CWnd* pParentWnd = NULL ,UINT iSelectPage = 0);
//Destructors
virtual ~MyPropertySheet();
virtual void DoDataExchange(CDataExchange* pDX);
public:
MyPropertyPage mypage;
CMFCBUTTON m_ok;
public:
virtual BOOL OnInitDialog();
protected:
DECLARE_MESSAGE_MAP()
};
Last edited by 2kaud; October 7th, 2019 at 05:10 AM.
Reason: Added code tags
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
|