CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 5 1234 ... LastLast
Results 1 to 15 of 92

Thread: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet

Hybrid View

  1. #1
    Join Date
    Sep 2019
    Posts
    30

    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

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,736

    Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet

    Victor Nijegorodov

  3. #3
    Join Date
    Sep 2019
    Posts
    30

    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

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,305

    Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet

    Please post the code you have to change the button color.

  5. #5
    Join Date
    Sep 2019
    Posts
    30

    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

  6. #6
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,736

    Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet

    What is CMFCBUTTON ?
    Victor Nijegorodov

  7. #7
    Join Date
    Sep 2019
    Posts
    30

    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

  8. #8
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,736

    Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet

    Quote Originally Posted by Sparsh_21j View Post
    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

  9. #9
    Join Date
    Sep 2019
    Posts
    30

    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"

  10. #10
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,736

    Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet

    Quote Originally Posted by Sparsh_21j View Post
    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

  11. #11
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,588

    Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet

    Quote Originally Posted by Sparsh_21j View Post
    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?

  12. #12
    Join Date
    Sep 2019
    Posts
    30

    Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet

    Yes you are right i am using MFC class provided by Microsoft

  13. #13
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    19,736

    Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet

    Quote Originally Posted by Sparsh_21j View Post
    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

  14. #14
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,305

    Re: Changing background Color of standard buttons (ok,cancel,help) of Cpropertysheet

    What is m_ok? Where is it set?

  15. #15
    Join Date
    Sep 2019
    Posts
    30

    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

Page 1 of 5 1234 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)