Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Draw something

Posted on 2000-03-07
2
Medium Priority
?
227 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 200 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

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

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

782 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