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/>}