C # drawing snowman with graphics

Source: Internet
Author: User

When I saw a piece of code on the Internet and found it interesting, I modified the shared csdn reader.

Program running interface:

Check the Code:

Private void printdramc (Graphics g) <br/>{< br/> const int mid = 150; <br/> const int Top = 50; <br/> This. TEXT = "simple graphics Snowman"; </P> <p> Font font = new font ("", 17 ); </P> <p> pen Blue = new pen (color. blue); <br/> pen yellow = new pen (color. yellow); <br/> pen white = new pen (color. white); <br/> pen red = new pen (color. red); <br/> pen black = new pen (color. black); <br/> brush brwhite = white. brush; <br/> brush brblack = black. brush; <br/> brush brred = red. brush; </P> <p> G. fillrectangle (brred, 20, 30, 30,120); <br/> G. fillrectangle (brred, 250, 30, 30,120); <br/> G. fillrectangle (brred, 100, 0,100, 25); </P> <p> stringformat format = new stringformat (); <br/> format. formatflags = stringformatflags. directionvertical; </P> <p> G. drawstring ("three cups of Songs", Font, brblack, 250, 30, format); <br/> G. drawstring ("", Font, brblack, 20, 30, format); <br/> G. drawstring ("", Font, brblack, 100, 0); </P> <p> G. drawrectangle (Blue, 0,175,300, 50); // sky <br/> G. drawellipse (yellow,-40,-40, 80, 80); // sun <br/> G. fillellipse (brwhite, mid-20, top, 40, 40); // head <br/> G. fillellipse (brwhite, mid-35, top + 35, 70, 50); // top <br/> G. fillellipse (brwhite, mid-50, top + 80,100, 60); // bot <br/> G. fillellipse (brblack, mid-10, top + 10, 5, 5); // L. eye <br/> G. fillellipse (brblack, Mid + 5, top + 10, 5, 5); // R. eye <br/> G. drawarc (black, mid-10, top + 20, 20, 10,-190,-160); // (: <br/> // arms <br/> G. drawline (black, mid-25, top + 60, top-50, Mid + 40); <br/> G. drawline (black, Mid + 25, top + 60, Mid + 55, top + 60); </P> <p> G. drawline (black, mid-20, top + 5, Mid + 20, top + 5); // hat, brim, top <br/> G. fillrectangle (brblack, mid-15, top-20, 30, 25); <br/>}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.