Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Draw something

Posted on 2000-03-07
2
Medium Priority
?
226 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses

705 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