using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WTD_Editor
{
    public partial class ChooseIcon : Form
    {
        public int selected;
        public ChooseIcon(int i)
        {
            InitializeComponent();
            pictureBox1.Image = WTD_Editor.Properties.Resources.icons;
            pictureBox2.Image = WTD_Editor.Properties.Resources.icons;
            pictureBox3.Image = WTD_Editor.Properties.Resources.icons;
            pictureBox4.Image = WTD_Editor.Properties.Resources.icons;
            pictureBox5.Image = WTD_Editor.Properties.Resources.icons;
            pictureBox6.Image = WTD_Editor.Properties.Resources.icons;
            pictureBox7.Image = WTD_Editor.Properties.Resources.icons;
            pictureBox8.Image = WTD_Editor.Properties.Resources.icons;
            pictureBox9.Image = WTD_Editor.Properties.Resources.icons;
            pictureBox1.Location = new Point(0, 0);
            pictureBox2.Location = new Point(16, -256);
            pictureBox3.Location = new Point(32, -512);
            pictureBox4.Location = new Point(48, -768);
            pictureBox5.Location = new Point(64, -1024);
            pictureBox6.Location = new Point(80, -1280);
            pictureBox7.Location = new Point(96, -1536);
            pictureBox8.Location = new Point(112, -1792);
            selected = i;
            refreshIcon();
        }

        private void refreshIcon()
        {
            pictureBox9.Location = new Point(0, -16*selected);
        }

        private void ChooseIcon_Load(object sender, EventArgs e)
        {

        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {
            selected = (this.PointToClient(Cursor.Position).Y - panel1.Location.Y) / 16;
            refreshIcon();
        }

        private void pictureBox2_Click(object sender, EventArgs e)
        {
            selected = (this.PointToClient(Cursor.Position).Y - panel1.Location.Y + 256) / 16;
            refreshIcon();
        }

        private void pictureBox3_Click(object sender, EventArgs e)
        {
            selected = (this.PointToClient(Cursor.Position).Y - panel1.Location.Y + 512) / 16;
            refreshIcon();
        }

        private void pictureBox4_Click(object sender, EventArgs e)
        {
            selected = (this.PointToClient(Cursor.Position).Y - panel1.Location.Y + 768) / 16;
            refreshIcon();
        }

        private void pictureBox5_Click(object sender, EventArgs e)
        {
            selected = (this.PointToClient(Cursor.Position).Y - panel1.Location.Y + 1024) / 16;
            refreshIcon();
        }

        private void pictureBox6_Click(object sender, EventArgs e)
        {
            selected = (this.PointToClient(Cursor.Position).Y - panel1.Location.Y + 1280) / 16;
            refreshIcon();
        }

        private void pictureBox7_Click(object sender, EventArgs e)
        {
            selected = (this.PointToClient(Cursor.Position).Y - panel1.Location.Y + 1536) / 16;
            refreshIcon();
        }

        private void pictureBox8_Click(object sender, EventArgs e)
        {
            selected = (this.PointToClient(Cursor.Position).Y - panel1.Location.Y + 1792) / 16;
            refreshIcon();
        }
    }
}