Thread: How to draw shapes and output?

  1. #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?

  2. #2
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    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);

  3. #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.

  4. #4
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Don't forget to call Dispose() on my_graph when you are done with it.

Popular pages Recent additions subscribe to a feed