Advertisement

03.18.2003 at 10:41AM PST, ID: 20555098
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.6

Setting background color of bitmap..........

Asked by sureshkumar_v in Web Ontology Language (OWL)

Tags: , ,

hi,
   how can i have a bitmap with user defined background color and a rectangle drawn on that? I have created a memorydc and bitmap using CreateCompatibleDc and  CreateCompatibleBitmap. Irrespective of any color, it is taking black as bitmap's bkcolor. I tried to assign the color by using FillRect. But got the same result (blak as bkcolor). My coding is given below.

 
class TDrawWindow : public TWindow {
    public:

       HDC hDC;
       HDC dcMem;
       HBITMAP bmMem;
       TRect rcClient,r1;
       TDrawWindow(TWindow* parent  = 0);
    protected:
          bool EvEraseBkgnd(HDC);
         DECLARE_RESPONSE_TABLE(TDrawWindow);
 };

 DEFINE_RESPONSE_TABLE1(TDrawWindow,TWindow)
    EV_WM_PAINT,
    EV_WM_ERASEBKGND,
 END_RESPONSE_TABLE;

 TDrawWindow::TDrawWindow(TWindow* parent) {
     r1.left   =  100;
     r1.top    =  100;
     r1.bottom =  200;
     r1.right  =  200;

     rcClient.top = 0;
     rcClient.left = 0;
     rcClient.bottom = 1000;
     rcClient.right = 1000;
 }

 bool TDrawWindow::EvEraseBkgnd(HDC) {
   return true;
}

void TDrawWindow :: Paint(TDC& dc,bool,TRect &r) {
     TBrush newbrush(TColor(255,0,0));
     dcMem = CreateCompatibleDC(hDC);
     if ((bmMem = CreateCompatibleBitmap(dc, rcClient.Width(),rcClient.Height())) == NULL)
     MessageBox("Cannot create compatiblebitmap","Error",MB_OK);
     SelectObject(dcMem, bmMem);
     TBrush tb(RGB(255,0,0));
     FillRect(dcMem,&rcClient,&tb);
     SelectObject(dcMem,newbrush);
     Rectangle (dcMem,r1.top,r1.left,r1.bottom,r1.right);    
     BitBlt(dc,rcClient.left, rcClient.top, rcClient.Width(), rcClient.Height(), dcMem, 0, 0, SRCCOPY);
     
}

class TDrawApp:public TApplication{
   public:
      TDrawApp():TApplication(){}
      void InitMainWindow(){
        SetMainWindow(new TFrameWindow(0,"Test",new TDrawWindow));
      }
};

int OwlMain(int,char* []){
  return TDrawApp().Run();
 }
Start Free Trial
[+][-]03.19.2003 at 07:12PM PST, ID: 8171340

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.20.2003 at 01:17AM PST, ID: 8172473

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Web Ontology Language (OWL)
Tags: color, background, bitmap
Sign Up Now!
Solution Provided By: Jogy
Participating Experts: 1
Solution Grade: B
 
 
[+][-]03.20.2003 at 01:21AM PST, ID: 8172486

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-42 - Hierarchy