Solved

Paint a grey rectangle with border on dialog

Posted on 2008-09-30
2
1,279 Views
Last Modified: 2013-11-20
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
Comment
Question by:Ocrana
2 Comments
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 22611104
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
 
LVL 19

Accepted Solution

by:
alb66 earned 500 total points
ID: 22612656
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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
tripleUp challenge 7 86
MaxSpan challenge 9 108
C++ mouse_event mouse look 7 99
Is there a simple front-end menu system. 9 105
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

821 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