Click here to Skip to main content
15,889,335 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a picturebox, 40 x 40, backcolor black. I want to draw a circle 40 x 40, color - white and text in the center of the circle, forecolor - black.

How do I do this???
Posted

This is quite possible (you need to get an instance of the Graphics of the picture and draw on it), but makes no sense. Instead, you can more easily draw on a custom Control, including Form or Panel. The class PictureBox won't add any useful functionality to it, will only create some hassles and eat up extra runtime and memory.

The question is: what to do instead? I explain it in my past solution: How do I clear a panel from old drawing[^].

The link provided by Mika also shows how to do it right.

—SA
 
Share this answer
 
v2
Comments
Wendelius 5-Sep-11 1:25am    
Good answer, my 5
Sergey Alexandrovich Kryukov 5-Sep-11 2:42am    
Thank you, Mika.
--SA
The idea of the picturebox is that you can load a picture into it. It's not meant to be drawn at directly.

Here's one good looking article: http://www.bobpowell.net/picturebox.htm[^]
 
Share this answer
 
Comments
rspercy65 4-Sep-11 13:54pm    
THNX ALOT...I totally forgot about Mr. Popwell's site.
Wendelius 4-Sep-11 13:58pm    
No problem, glad it helped :)
Sergey Alexandrovich Kryukov 5-Sep-11 1:21am    
I agree, but, strictly speaking, drawing on PictureBox is possible, only it makes no sense. I voted 4.
Also, what to do?
I answered this question, please see.
Your answer is credited, your link also provides the answer.
--SA
Wendelius 5-Sep-11 1:24am    
Exactly, also efficient repainting can be a mess depending on the graphics.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900