Example #1
0
File: Form1.cs Project: FMI-VT/API
        private void button1_Click(object sender, EventArgs e)
        {
            Class1 test = new Class1(textBox1.Text, textBox2.Text);

            test.PRINT();

            if (checkBox1.Checked == true)
            {
                MessageBox.Show("RESIZING!");
                int x = 0;
                int y = 0;

                if (radioButton1.Checked == true)
                {
                    x = 1920;
                    y = 1080;
                }

                if (radioButton2.Checked == true)
                {
                    x = 1280;
                    y = 720;
                }

                if (radioButton3.Checked == true)
                {
                    try
                    {
                        x = int.Parse(textBox3.Text);
                        y = int.Parse(textBox4.Text);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Неправилно въведени размери!", "Грешка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                if (checkBox2.Checked == true)
                {
                    if (radioButton4.Checked == true)
                    {
                        type = 1; //JPG
                    }
                    if (radioButton5.Checked == true)
                    {
                        type = 2;  //PNG
                    }
                    if (radioButton6.Checked == true)
                    {
                        type = 3; // GIF
                    }
                }
                else
                {
                    type = 1;
                }


                test.Resize(x, y, Quality, type);
            }
            if (checkBox2.Checked == true && checkBox1.Checked == false)
            {
                MessageBox.Show("CHANGING FILE TYPE");


                if (radioButton4.Checked == true)
                {
                    type = 1; //JPG
                }
                if (radioButton5.Checked == true)
                {
                    type = 2;  //PNG
                }
                if (radioButton6.Checked == true)
                {
                    type = 3; // GIF
                }

                test.convert(type);
            }
        }