public static void Open(IListItemEx file) { var f = new ResizeImage(); f.InitializeComponent(); f.textBlock1.Text = f.FindResource("txtFilename") + ": " + file.GetDisplayName(SIGDN.NORMALDISPLAY); f.cvt = new Bitmap(file.ParsingName); f.textBlock2.Text = f.FindResource("lblHeightCP") + ": " + f.cvt.Height.ToString(); f.textBlock3.Text = f.FindResource("lblWidthCP") + ": " + f.cvt.Width.ToString(); f.spinner1.Value = 100; f.percsetting = true; f.textBox1.Text = f.cvt.Width.ToString(); f.textBox2.Text = f.cvt.Height.ToString(); f.percsetting = false; f.ShowDialog(); if (f.Confirm) { System.Drawing.Bitmap cvt = new Bitmap(file.ParsingName); System.Drawing.Bitmap cst = ChangeImageSize(cvt, f.newwidth, f.newheight); string ext = file.Extension; cst.Save(file.ParsingName + " (" + f.newwidth + " X " + f.newheight + ")" + ext); cvt.Dispose(); cst.Dispose(); } }
private void btnResize_Click(object sender, RoutedEventArgs e) { ResizeImage ri = new ResizeImage(Explorer.SelectedItems[0]); ri.ShowDialog(); if (ri.Confirm == true) { System.Drawing.Bitmap cvt = new Bitmap(Explorer.SelectedItems[0].ParsingName); System.Drawing.Bitmap cst = ChangeImageSize(cvt, ri.newwidth, ri.newheight); string ext = GetExtension(Explorer.SelectedItems[0].ParsingName); cst.Save(Explorer.SelectedItems[0].ParsingName + " (" + ri.newwidth + " X " + ri.newheight + ")" + ext); cvt.Dispose(); cst.Dispose(); } }