Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Porgress control has no background?

Posted on 1998-03-24
3
Medium Priority
?
311 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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 …
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 tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

618 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