Solved

Porgress control has no background?

Posted on 1998-03-24
3
295 Views
Last Modified: 2013-11-19
Thanks.

I wanted to change the background color of progress control.
In dialog, I overrided WM_CTLCOLOR.
The class wizard created a function called as OnCtlColor().
Below is my code.

HBRUSH CMyDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlcolor)
{
     if (m_progress.GetSafeHwnd() == pWnd->GetSafeHwnd())
          return m_brush;                    // for example, red brush

     HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
     return hbr;
}

My progress control still has gray background.

***********

I have another question.
How can I remove or erase the "border" of  progress control?
The style of "border" is WM_EX_STATICEDGE.
I create new class. Base class is CProgressCtrl.
I overrided WM_PAINT message.
But, I can't erase the "border".

Best regards...
Thanks again. Good lucks!
0
Comment
Question by:hotheart
3 Comments
 

Author Comment

by:hotheart
ID: 1317196
Edited text of question
0
 

Expert Comment

by:nbushman
ID: 1317197
I had to change the background color of one of my CStatic controls, IDC_STATIC_STUDENT_NAME, in a CFormView...  Maybe what I did will help you with your code.  Maybe not.  Good luck!

HBRUSH CEvaluatorView::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
  HBRUSH hbr = CFormView::OnCtlColor(pDC, pWnd, nCtlColor);
      
  // TODO: Change any attributes of the DC here
  if (nCtlColor == CTLCOLOR_STATIC &&
      pWnd->GetDlgCtrlID() == IDC_STATIC_STUDENT_NAME)
  {
            
     pDC->SetTextColor(RGB(255, 255, 255));
     pDC->SetBkColor(GetSysColor(COLOR_INACTIVECAPTION));

     return m_brush;
  }
      
  // TODO: Return a different brush if the default is not desired

  return hbr;
}
0
 
LVL 8

Accepted Solution

by:
gelbert earned 0 total points
ID: 1317198
Try process WM_ERASEBKGND. See VC++ help for Cwnd::OnEraseBkgnd
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Different colored text in ComboBox without Subclassing 8 62
has22 challenge 11 96
wait notify demo infinite loop 3 114
zeroMAx challenge 20 105
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question