You are here:

C++/How to draw a graphics like circle


   I am using 5.02 version of C++.I want to draw graphicslike circle or any others graphics on screen but How to do this pls help me?
Zaheer Ahmed

Hello zaheer, thank you for the question.

This is an easy problem. This is also assuming it is a Windows application.

You can get a handle to a device context by calling GetDC(), then you can use that device context to draw. Example:

HDC hdc = GetDC(hWnd);
Ellipse(hdc, 0, 0, 50, 50);

That will draw a circle that fills in the area of a square that is 50 pixels by 50 pixels. Rectangle is the function that can draw you a rectangle. LineTo can draw lines. If you have any other questions, please do not hesitate to ask.

I hope this information was helpful.

- Eddie


All Answers

Answers by Expert:

Ask Experts




I can answer questions about the C++ language, object oriented design and architecture. I am knowledgable in a lot of the math that goes into programming, and am certified by I also know a good deal about graphics via OpenGL, and GUIs.


I have completed numerous games and demos created with the C++ programming language. Currently employed as a software engineer in the modeling and simulation field. I have about 7 years experience.

©2017 All rights reserved.

[an error occurred while processing this directive]