CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Threaded View

  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

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
  •  





Click Here to Expand Forum to Full Width

Featured