?
Solved

Porgress control has no background?

Posted on 1998-03-24
3
Medium Priority
?
307 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses
Course of the Month8 days, 23 hours left to enroll

765 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