How to draw shapes and output?

This is a discussion on How to draw shapes and output? within the C# Programming forums, part of the General Programming Boards category; Could someone tell me how i could accomplish this? Basically .. i want to draw a circle and fill it ...

  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
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    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
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    Don't forget to call Dispose() on my_graph when you are done with it.

Popular pages Recent additions subscribe to a feed

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