Skip to content

Instantly share code, notes, and snippets.

@WildGenie
Created April 19, 2016 11:02
Show Gist options
  • Save WildGenie/7b410ffdcf5b3c716eb002923fd0afa4 to your computer and use it in GitHub Desktop.
Save WildGenie/7b410ffdcf5b3c716eb002923fd0afa4 to your computer and use it in GitHub Desktop.
using System;
using System.Drawing;
using System.Windows.Forms;
namespace DrawCar
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Pen pen1 = new Pen(Color.Blue, 2F);
Pen pen2 = new Pen(Color.Green, 2F);
int x = 100;
int y = 100;
Graphics g = pictureBox1.CreateGraphics();
g.DrawEllipse(pen1, x, y, 30, 30);
g.DrawEllipse(pen1, x + 100, y, 30, 30);
g.DrawRectangle(pen2, x - 5, y + 50, 140, 50);
g.DrawLine(pen2, x + 15, y + 50, x + 30, y + 90);
g.DrawLine(pen2, x + 30, y + 90, x + 90, y + 90);
g.DrawLine(pen2, x + 90, y + 90, x + 110, y + 50);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment