Пример #1
0
 /// <summary>
 /// Start writing images in ICON file.
 /// </summary>
 private void Save()
 {
     //Disable controls
     SetControls(false);
     SetStatus("Starting...");
     try
     {
         //Check if the output file already exists.
         if (File.Exists(txtOutput.Text))
         {
             var dr = MessageBox.Show("The file: " + txtOutput.Text + " already exist. Do you want to over-write with new one?", "PNG2ICO | WARNING", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
             if (dr == DialogResult.No)
             {
                 Browse();
             }
             else if (dr == DialogResult.Cancel)
             {
                 return;
             }
         }
         //if not:
         Png2Ico.Convert(txtInput.Text, txtOutput.Text, SelectedSizes(), checkAllSizes.Checked && radioNewFile.Checked, checkAspectRatio.Checked);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error: " + ex.ToString(), "PNG2ICO - ERROR");
     }
     //Enable controls.
     SetControls(true);
 }
Пример #2
0
 private void comboSizes_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txtInput.Text) || !(File.Exists(txtInput.Text)))
     {
         return;
     }
     LoadImage(Png2Ico.Resize(Image.FromFile(txtInput.Text), ImageSizes[comboSizes.SelectedIndex]));
 }