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: 1295
  • Last Modified:

Paint a grey rectangle with border on dialog

Hi,

anyone here who can give me a short sample of how to paint a rectangle, filled with grey, and a 1 pixel black border on a dialog with GDI+?  I use VS 2005 and try it on a dialogbased app.

Thanks,

Ocrana
0
Ocrana
Asked:
Ocrana
1 Solution
 
Jaime OlivaresSoftware ArchitectCommented:
it has to be with GDI+?
the simplest way to paint a rectangle in a dialog is to put an empty static (aka "label") at design time.
0
 
alb66Commented:
void CAboutDlg::OnPaint()
{
      CPaintDC dc(this); // device context for painting
      
      dc.SelectObject( ::GetStockObject( BLACK_PEN ));
      dc.SelectObject( ::GetStockObject( GRAY_BRUSH ));
      
      dc.Rectangle( 10, 10, 50, 20 );
}
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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