예제 #1
0
 private void ICOurl_TextChanged(object sender, EventArgs e)
 {
     if (urltext != null && !string.IsNullOrWhiteSpace(ICOurl.Text))
     {
         try
         {
             using (Stream stream = new WebClient().OpenRead(ICOurl.Text))
                 using (Bitmap bitmap = new Bitmap(stream))
                 {
                     if (bitmap != null)
                     {
                         bitmap.Save(temppath + @"tempORIGINAL.png");
                         ImagingHelper.ConvertToIcon(temppath + @"tempORIGINAL.png", temppath + @"temp.ico");
                         ICOpic.Image = ImagingHelper.ICONbox;
                         ICOpic.Image.Save(temppath + @"temp.png");
                     }
                 }
         }
         catch
         {
             MessageForm.Error("URL provided isn't an image...");
         }
         Shortcutbox.Focus();
     }
 }
예제 #2
0
        private async void ICOpic_MouseClick(object sender, MouseEventArgs e)
        {
            if (TempString == null)
            {
                if (clicked)
                {
                    return;
                }
                clicked = true;
                await Task.Delay(SystemInformation.DoubleClickTime);

                if (!clicked)
                {
                    return;
                }
                clicked = false;
            }

            //Process click
            var file = TempString != null ? TempString : FileDialog(Path.Combine(Environment.GetEnvironmentVariable("USERPROFILE"), "Downloads"), "PNG/JPG Image (*.png; *.jpg; *.jpeg *.tiff *.bmp)|*.png;*.jpg;*.jpeg;*.tiff;*.bmp");

            TempString = null;

            if (file != null && File.Exists(file))
            {
                File.Copy(file, temppath + "tempORIGINAL.png", true);
                ImagingHelper.ConvertToIcon(temppath + "tempORIGINAL.png", temppath + @"temp.ico");
                ICOpic.Image = ImagingHelper.ICONbox;
                ICOpic.Image.Save(temppath + @"temp.png");
            }

            Shortcutbox.Focus();
        }
예제 #3
0
        private void ICOpic_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            clicked = false;

            //Process click
            if (ICOpic.Image != null)
            {
                using (var CI = new CropImage_Tool())
                {
                    CI.ShowDialog();
                    if (CI.DialogResult1 == DialogResult.Yes)
                    {
                        ImagingHelper.ConvertToIcon(temppath + "temp.png", temppath + @"temp.ico");
                        ICOpic.Image = ImagingHelper.ICONbox;
                        ICOpic.Image.Save(temppath + @"temp.png");
                    }
                }
            }
            else
            {
                MessageForm.Info("First select a picture to crop");
            }
        }