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 WindowsFormsApp26
- {
- public partial class Form1 : Form
- {
- Graphics myCanvas;
- Pen myPen = new Pen(Color.Green, 3.0f);
- int oldX = 0;
- int oldY = 0;
- public Form1()
- {
- InitializeComponent();
- }
- private void btnTegn_Click(object sender, EventArgs e)
- {
- int newX = int.Parse(txtX.Text);
- int newY = int.Parse(txtY.Text);
- myCanvas.DrawLine(myPen, oldX, oldY, newX, newY);
- oldX = newX;
- oldY = newY;
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- myCanvas = this.CreateGraphics();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment