Advertisement
AalborgHTX

Grafik i C#

Mar 25th, 2019
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.93 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 WindowsFormsApplication4
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         public Form1()
  16.         {
  17.             InitializeComponent();
  18.         }
  19.         Graphics lærred;
  20.         Pen blyant;
  21.  
  22.         private void btnTegn_Click(object sender, EventArgs e)
  23.         {
  24.             int x1 = int.Parse(txtX1.Text);
  25.             int y1 = int.Parse(txtY1.Text);
  26.             int x2 = int.Parse(txtX2.Text);
  27.             int y2 = int.Parse(txtY2.Text);
  28.  
  29.             lærred.DrawLine(blyant, x1, y1, x2, y2);
  30.  
  31.         }
  32.  
  33.         private void Form1_Load(object sender, EventArgs e)
  34.         {
  35.             lærred = this.CreateGraphics();
  36.             blyant = new Pen(Color.Blue, 1.0f);
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement