Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Drawing;
- using System.Windows.Forms;
- namespace WindowsFormsApplication1
- {
- public partial class Form1 : Form
- {
- Bitmap drawBitmap;
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- InitDraw();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- Draw();
- }
- private void InitDraw()
- {
- drawBitmap = new Bitmap(500, 500);
- pictureBox1.Image = drawBitmap;
- }
- private void Draw()
- {
- Graphics g = Graphics.FromImage(pictureBox1.Image);
- Pen myPen = new Pen(Color.Black);
- g.DrawLine(myPen, 0, 0, 100, 100);
- myPen.Dispose();
- g.Dispose();
- Invalidate();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement