how to change the color of property sheet wizard button in VC++
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: how to change the color of property sheet wizard button in VC++

  1. #1
    Join Date
    Jan 2011
    Posts
    9

    how to change the color of property sheet wizard button in VC++

    Hi All,

    I want to change the color of property sheet wizard button. The wizard has ID_WIZNEXT, ID_WIZFINISH and other default button. the button label and position is changed. i want to change the color of this default button.

    Code:
    class CDiskSanPropertySheet : public CPropertySheet
    {
    }
    
    
    BOOL CDiskSanPropertySheet::OnInitDialog()
    {
    	CPropertySheet::OnInitDialog();
    
            CButton *tmpButtonNext = reinterpret_cast<CButton *>(GetDlgItem(ID_WIZNEXT));
    	CButton *tmpButtonFinish = reinterpret_cast<CButton *>(GetDlgItem(ID_WIZFINISH));
    	CButton *tmpButtonBack = reinterpret_cast<CButton *>(GetDlgItem(ID_WIZBACK));
    	CButton *tmpButtonCancel = reinterpret_cast<CButton *>(GetDlgItem(IDCANCEL));
    
            buttonString.LoadStringW(IDS_TEXT_BUTTON_NEXT);
    	tmpButtonNext->SetWindowTextW(buttonString.GetBuffer());
    	
    	buttonString.ReleaseBuffer();
    
            LONG rightPos, nextRightPos;
    	
    	//inc. to 1.7 for greek issue
    	MoveButton(tmpButtonCancel,shiftFactorX, 1.7,NULL,tmpButtonNext,&nextRightPos);
    	MoveButton(tmpButtonFinish,shiftFactorX, 1.7,NULL,NULL,NULL);
    
    	rightPos = nextRightPos;
    
    	MoveButton(tmpButtonNext,shiftFactorX, 1.7,&rightPos,tmpButtonBack,&nextRightPos);
    	
    	rightPos = nextRightPos;
    	
    	MoveButton(tmpButtonBack,shiftFactorX, 1.7,&rightPos,NULL,NULL);
    
    }
    
    HBRUSH CDiskSanPropertySheet::OnCtlColor(CDC* pDC, CWnd *pWnd, UINT nCtlColor)
    {
        HBRUSH hbr = CPropertySheet::OnCtlColor(pDC,pWnd, nCtlColor);
    
        COLORREF myColor = RGB(250,250,250);
    	//COLORREF myColor = RGB(0, 0, 255);
    
    	TCHAR classname[MAX_PATH];
        if(::GetClassName(pWnd->m_hWnd, classname, MAX_PATH) == 0)
            return hbr;
        if(_tcsicmp(classname, _T("EDIT")) == 0)
     
        if(_tcsicmp(classname, _T("LISTBOX")) == 0)
            return hbr;
        if(_tcsicmp(classname, WC_TREEVIEW) == 0)
            return hbr;
    	
        
        		 pDC->SetTextColor((myColor)); 
    	 if ((HBRUSH)brush == NULL)
    		 brush.CreateSolidBrush((myColor));
    	 
         return (HBRUSH) brush;
    } 
    I want to change the color of the above button. Please help me to resolve this.

    Regards,

    Rani
    Last edited by 2kaud; June 3rd, 2017 at 02:33 AM. Reason: Added code tags

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    18,940

    Re: how to change the color of property sheet wizard button in VC++

    Quote Originally Posted by smrani View Post
    Hi All,

    I want to change the color of property sheet wizard button. The wizard has ID_WIZNEXT, ID_WIZFINISH and other default button. the button label and position is changed. i want to change the color of this default button.

    ...

    I want to change the color of the above button. Please help me to resolve this.
    i
    Just have a look at what the other guys did in a similar situation:
    http://www.codeguru.com/cpp/controls...red-Button.htm
    http://forums.codeguru.com/showthrea...lor-of-CButton
    https://social.msdn.microsoft.com/Fo...orum=vcgeneral
    https://social.msdn.microsoft.com/Fo...orum=vcgeneral
    ...
    https://www.google.ch/search?q=chang...hrome&ie=UTF-8
    Victor Nijegorodov

  3. #3
    Join Date
    Jun 2003
    Location
    Armenia, Yerevan
    Posts
    693

    Re: how to change the color of property sheet wizard button in VC++

    I have no idea how this can be achieved, however the right cast would be static_cast instead of reinterpret_cast.
    Just FYI.
    Popular opinion is the greatest lie in the world.

Tags for this Thread

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

This a Codeguru.com survey!


On-Demand Webinars (sponsored)