Solved

Porgress control has no background?

Posted on 1998-03-24
3
291 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
Comment Utility
Edited text of question
0
 

Expert Comment

by:nbushman
Comment Utility
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
Comment Utility
Try process WM_ERASEBKGND. See VC++ help for Cwnd::OnEraseBkgnd
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
This video discusses moving either the default database or any database to a new volume.

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now