Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace Drawing
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void DrawSq(int x, int y, Pen MyPen, Graphics g)
- {
- g.DrawLine(MyPen, x, y, x + 15, y + 15);
- g.DrawLine(MyPen, x, y, x, y - 30);
- g.DrawLine(MyPen, x + 30, y, x + 30, y - 30);
- g.DrawLine(MyPen, x, y - 30, x + 15, y - 50);
- g.DrawLine(MyPen, x + 30, y - 30, x + 15, y - 50);
- g.DrawLine(MyPen, x + 30, y, x + 15, y + 15);
- g.DrawEllipse(MyPen, x + 1 , y - 43, 28 , 53 );
- g.DrawEllipse(MyPen, x - 9, y - 57, 48 , 85 );
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- }
- private void Form1_Paint(object sender, PaintEventArgs e)
- {
- Graphics g = CreateGraphics();
- Pen MyPen = new Pen(Color.Blue);
- DrawSq(40, 150, MyPen, g);
- DrawSq(10, 200, MyPen, g);
- DrawSq(90, 200, MyPen, g);
- DrawSq(250, 200, MyPen, g);
- DrawSq(180, 200, MyPen, g);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement