Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 852
  • Last Modified:

Gradient Fills

How can I implement gradient fills in the client area of a window using MFC ?

0
coke
Asked:
coke
1 Solution
 
Tommy HuiEngineerCommented:
Gradient fills are usually implemented by dividing the paint region into smaller rectangular regions. Then each of the small rectangular regions are painted with a color and the next region is painted with a small change of color. Pseudo code is the following:

  // assume region is the screen and the screen is divided into
  // 255 regions
  for (int i = 0; i < 256; i++)
  {
    CColor color(i, i, i);
    CBrush brush(color);
    dc.Rectangle(rectangle[i], brush);
  }


0
 
davmarcCommented:
thui,
I wonder where you found that CColor MFC class... :-)

Davide Marcato.
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now