C Board  

Go Back   C Board > General Programming Boards > C# Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 11-18-2007, 05:37 PM   #1
Registered User
 
Join Date: Aug 2007
Posts: 33
How to draw shapes and output?

Could someone tell me how i could accomplish this?
Basically .. i want to draw a circle and fill it with a colour. Could you show me the code thats needed to do this?
Diablo02 is offline   Reply With Quote
Old 11-18-2007, 10:29 PM   #2
Super Moderator
 
Bubba's Avatar
 
Join Date: Aug 2001
Posts: 7,819
You will need a control or form.

Some of my code mixed with code from C# help samples
Code:
Graphics my_graph =  CreateGraphics();
...
SolidBrush redBrush = new SolidBrush(Color.Red);
             
// Create location and size of ellipse.
int x = 0;
int y = 0;
int width = 200;
int height = 100;
             
// Fill ellipse on screen.
my_graph.FillEllipse(redBrush, x, y, width, height);
Bubba is offline   Reply With Quote
Old 11-19-2007, 02:32 PM   #3
Registered User
 
Join Date: Aug 2007
Posts: 33
Hmm, ive tried the code, but it doesn't draw it... Am I missing something?

Nevermind, i got it to work. Thx!

Last edited by Diablo02; 11-19-2007 at 02:46 PM.
Diablo02 is offline   Reply With Quote
Old 11-20-2007, 07:11 PM   #4
Super Moderator
 
Bubba's Avatar
 
Join Date: Aug 2001
Posts: 7,819
Don't forget to call Dispose() on my_graph when you are done with it.
Bubba is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump


All times are GMT -6. The time now is 07:54 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22