﻿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 Liki
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        // narišemo črto
        private void button1_Click(object sender, EventArgs e)
        {
            Graphics platno;
            platno = this.CreateGraphics();
            Pen svincnik1 = new Pen(Color.Green, 3);
            platno.DrawLine(svincnik1, 80, 120, 180, 300);
        }

        // narišemo pravokotnik
        private void button2_Click(object sender, EventArgs e)
        {
            Graphics platno;
            platno = this.CreateGraphics();
            Pen svincnik2 = new Pen(Color.Red, 3);
            Rectangle pravokotnik = new Rectangle(60, 100, 300, 200);
            platno.DrawRectangle(svincnik2, pravokotnik);

        }

        // narišemo elipso
        private void button3_Click(object sender, EventArgs e)
        {
            Graphics platno;
            platno = this.CreateGraphics();
            Pen svincnik3 = new Pen(Color.Blue, 3);
            Rectangle elipsa = new Rectangle(60, 100, 300, 200);
            platno.DrawEllipse(svincnik3, elipsa);
            

        }

        // narišemo večkotnik
        private void button4_Click(object sender, EventArgs e)
        {
            Graphics platno;
            platno = this.CreateGraphics();
            Pen svincnik4 = new Pen(Color.Yellow, 3);
            Point[] tocke = new Point[4];
            tocke[0] = new Point(90, 130);
            tocke[1] = new Point(150, 200);
            tocke[2] = new Point(250, 70);
            tocke[3] = new Point(140, 300);
            platno.DrawPolygon(svincnik4, tocke);

        }

        // narišemo krivuljo
        private void button9_Click(object sender, EventArgs e)
        {
            Graphics platno;
            platno = this.CreateGraphics();
            Pen svincnik5 = new Pen(Color.Blue, 4);
            Point tocka1 = new Point(50, 50);
            Point tocka2 = new Point(100, 25);
            Point tocka3 = new Point(200, 5);
            Point tocka4 = new Point(250, 50);
            Point tocka5 = new Point(300, 100);
            Point tocka6 = new Point(350, 200);
            Point tocka7 = new Point(250, 250);
            Point[] tocke = { tocka1, tocka2, tocka3, tocka4, tocka5, tocka6, tocka7 };
            platno.DrawCurve(svincnik5, tocke);
        }

        // narišemo Bezierjevo krivuljo
        private void button5_Click(object sender, EventArgs e)
        {
            Graphics platno;
            platno = this.CreateGraphics();
            Pen svincnik6 = new Pen(Color.BlueViolet, 4);
            Point zacetek = new Point(100, 100);
            Point kontrolna_tocka1 = new Point(250, 70);
            Point kontrolna_tocka2 = new Point(400, 120);
            Point konec = new Point(500, 200);
            platno.DrawBezier(svincnik6, zacetek, kontrolna_tocka1, kontrolna_tocka2, konec);
        }

        // pobarvamo elipso
        private void button6_Click(object sender, EventArgs e)
        {
            Graphics platno;
            platno = this.CreateGraphics();
            SolidBrush barva = new SolidBrush(Color.Red); ;
            Rectangle elipsa2 = new Rectangle(60, 100, 300, 200);
            platno.FillEllipse(barva, elipsa2);

        }
        //narišemo sliko
        private void button7_Click(object sender, EventArgs e)
        {
            Graphics platno;
            platno = this.CreateGraphics();
            Image slika = Image.FromFile("slika.jpg");
            float x = 100.0F;
            float y = 100.0F;
            RectangleF srcRect = new RectangleF(250.0F, 250.0F, 300.0F, 300.0F);
            GraphicsUnit units = GraphicsUnit.Pixel;
            platno.DrawImage(slika, x, y, srcRect, units);
        }

        // "narišemo" besedilo
        private void button8_Click(object sender, EventArgs e)
        {
            Graphics platno;
            platno = this.CreateGraphics();
            String besedilo = "Pozdravljeni!";
            Font pisava = new Font("Calibri", 50);
            SolidBrush barva2 = new SolidBrush(Color.Black);
            platno.DrawString(besedilo, pisava, barva2, 100, 150);
        }

        // izbrišemo narisane like
        private void button10_Click(object sender, EventArgs e)
        {
            Graphics platno;
            platno = this.CreateGraphics();
            Pen p = new Pen(BackColor, 5);

            platno.DrawLine(p, 80, 120, 180, 300);

            Rectangle pravokotnik = new Rectangle(60, 100, 300, 200);
            platno.DrawRectangle(p, pravokotnik);

            Rectangle elipsa = new Rectangle(60, 100, 300, 200);
            platno.DrawEllipse(p, elipsa);

            Point[] tocke = new Point[4];
            tocke[0] = new Point(90, 130);
            tocke[1] = new Point(150, 200);
            tocke[2] = new Point(250, 70);
            tocke[3] = new Point(140, 300);
            platno.DrawPolygon(p, tocke);

            Point tocka1 = new Point(50, 50);
            Point tocka2 = new Point(100, 25);
            Point tocka3 = new Point(200, 5);
            Point tocka4 = new Point(250, 50);
            Point tocka5 = new Point(300, 100);
            Point tocka6 = new Point(350, 200);
            Point tocka7 = new Point(250, 250);
            Point[] tocke1 = { tocka1, tocka2, tocka3, tocka4, tocka5, tocka6, tocka7 };
            platno.DrawCurve(p, tocke1);

            Point zacetek = new Point(100, 100);
            Point kontrolna_tocka1 = new Point(250, 70);
            Point kontrolna_tocka2 = new Point(400, 120);
            Point konec = new Point(500, 200);
            platno.DrawBezier(p, zacetek, kontrolna_tocka1, kontrolna_tocka2, konec);

            SolidBrush barva = new SolidBrush(BackColor); ;
            Rectangle elipsa2 = new Rectangle(60, 100, 300, 200);
            platno.FillEllipse(barva, elipsa2);

            String besedilo = "Pozdravljeni!";
            Font pisava = new Font("Calibri", 50);
            SolidBrush barva2 = new SolidBrush(BackColor);
            platno.DrawString(besedilo, pisava, barva2, 100, 150);


        }
    }
}
