Solved

Paint a grey rectangle with border on dialog

Posted on 2008-09-30
2
1,275 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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 goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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.

813 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now