Advertisement
Guest User

Untitled

a guest
Feb 13th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace Drawing
  12. {
  13. public partial class Form1 : Form
  14. {
  15. public Form1()
  16. {
  17. InitializeComponent();
  18. }
  19. private void DrawSq(int x, int y, Pen MyPen, Graphics g)
  20. {
  21. g.DrawLine(MyPen, x, y, x + 15, y + 15);
  22. g.DrawLine(MyPen, x, y, x, y - 30);
  23. g.DrawLine(MyPen, x + 30, y, x + 30, y - 30);
  24. g.DrawLine(MyPen, x, y - 30, x + 15, y - 50);
  25. g.DrawLine(MyPen, x + 30, y - 30, x + 15, y - 50);
  26. g.DrawLine(MyPen, x + 30, y, x + 15, y + 15);
  27. g.DrawEllipse(MyPen, x + 1 , y - 43, 28 , 53 );
  28. g.DrawEllipse(MyPen, x - 9, y - 57, 48 , 85 );
  29.  
  30.  
  31. }
  32.  
  33. private void Form1_Load(object sender, EventArgs e)
  34. {
  35.  
  36. }
  37.  
  38. private void Form1_Paint(object sender, PaintEventArgs e)
  39. {
  40. Graphics g = CreateGraphics();
  41. Pen MyPen = new Pen(Color.Blue);
  42. DrawSq(40, 150, MyPen, g);
  43.  
  44. DrawSq(10, 200, MyPen, g);
  45. DrawSq(90, 200, MyPen, g);
  46. DrawSq(250, 200, MyPen, g);
  47. DrawSq(180, 200, MyPen, g);
  48.  
  49.  
  50. }
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement