Solved

Draw something

Posted on 2000-03-07
2
213 Views
Last Modified: 2010-04-02
I have a dialog based application, I would like to draw something (say, a circle) in a given area on the dialog box(better) or on a new window as I click a "Draw" button on the dialog box. How to do it?
0
Comment
Question by:yingchunli
2 Comments
 
LVL 8

Expert Comment

by:gelbert
ID: 2593418
You can create static control and handle WM_PAINT message. This message handler should implement painting of whatever you want.
So when user press "draw" button you can just call Invalidate() & UpdateWindow() with window handle of static control.
0
 
LVL 22

Accepted Solution

by:
nietod earned 50 total points
ID: 2593442
For windows?

You draw a circle using the Ellipse() function.  You will need to have a DC to draw in.  Usually you do this in the WM_PAINT message so you can get this DC from the BeginPaint() function.

Like

case WM_PAINT:
{
   PAINTSTRUCT PS;
    HDC DCHnd = BeginPaint(WndHnd,&PS);
    RECT CltRct;
    GetClientRect(WndHnd,&CltRct);
    Ellipse(DCHnd,CltRct.left, CltRct.top, CltRec.right, CltRct.bottom);
    EndPaint(WndHnd,&PS);
    break;
}

let me know if you have any questions
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

747 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

14 Experts available now in Live!

Get 1:1 Help Now