private void buttonFolderSelect_Click(object sender, EventArgs e) { FolderBrowserDialog FolderBrowserDialog1 = new FolderBrowserDialog(); FolderBrowserDialog1.SelectedPath = iniFile.ReadINI("Catalogs", "lastOpen"); if (FolderBrowserDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { buttonRescale.Text = "ОБРАБОТАТЬ"; path = FolderBrowserDialog1.SelectedPath; iniFile.WriteINI("Catalogs", "lastOpen", path); dir = new DirectoryInfo(path); files = new List <string>(); textBoxFilename.Text = path; listBoxFiles.Items.Clear(); string validExtensions = "*.jpg,*.jpeg,*.bmp"; string[] extFilter = validExtensions.Split(new char[] { ',' }); foreach (string extension in extFilter) { foreach (FileInfo file in dir.GetFiles(extension)) { files.Add(Path.GetFileName(file.FullName)); } } foreach (string nameFile in files) { listBoxFiles.Items.Add(nameFile); } name = files[0]; rescaling = new Rescaling(this, path, name); listboxSelectedItem(files[0]); listBoxFiles.SelectedIndex = 0; setMaxMinNumericUpDown(); resultSizeIndentInitialization(); currentSizeIndentInitialization(); showCurrentResolution(); showResultResolution(); showResultImage(); showCurrentImage(); buttonsEnable(); buttonRescaleAll.Enabled = true; } }
private void buttonRescaleAll_Click(object sender, EventArgs e) { foreach (string name in files) { this.name = name; rescaling = new Rescaling(this, path, name, rescaling.CURRENT_X0, rescaling.CURRENT_Y0, rescaling.RESULT_X0, rescaling.RESULT_Y0, rescaling.CURRENT_WIDTH, rescaling.CURRENT_HEIGHT, rescaling.CROPPED_WIDTH, rescaling.CROPPED_HEIGHT, rescaling.RESULT_FULL_WIDTH, rescaling.RESULT_FULL_HEIGHT); rescaling.resizeImage(); saveImage(); } saveToINI(); rescaling = new Rescaling(this, path, files[listBoxFiles.SelectedIndex], rescaling.CURRENT_X0, rescaling.CURRENT_Y0, rescaling.RESULT_X0, rescaling.RESULT_Y0, rescaling.CURRENT_WIDTH, rescaling.CURRENT_HEIGHT, rescaling.CROPPED_WIDTH, rescaling.CROPPED_HEIGHT, rescaling.RESULT_FULL_WIDTH, rescaling.RESULT_FULL_HEIGHT); buttonRescaleAll.Text = "УСПЕХ"; }
private void listboxSelectedItem(string selectedName) { name = selectedName; filename = path + '\\' + name; rescaling = new Rescaling(this, path, name); currentSizeIndentInitialization(); resultSizeIndentInitialization(); showCurrentResolution(); showResultImage(); showCurrentImage(); buttonRescale.Enabled = true; }
private void buttonFileSelect_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.InitialDirectory = iniFile.ReadINI("Catalogs", "lastOpen"); openFileDialog1.Filter = "JPEG files|*.jpg|BMP files|*.bmp|All files|*.*"; openFileDialog1.Title = "Выбор изображения для обработки"; if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { buttonRescale.Text = "ОБРАБОТАТЬ"; path = openFileDialog1.FileName; name = Path.GetFileName(path); listBoxFiles.Items.Clear(); listBoxFiles.Items.Add(name); int l = name.Length; path = path.Remove(path.Length - l, l); iniFile.WriteINI("Catalogs", "lastOpen", path); textBoxFilename.Text = path.Remove(path.Length - 1, 1); filename = path + '\\' + name; rescaling = new Rescaling(this, path, name); //setMaxMinNumericUpDown(); resultSizeIndentInitialization(); currentSizeIndentInitialization(); showCurrentResolution(); showResultResolution(); showResultImage(); showCurrentImage(); //setMaxMinNumericUpDown(); buttonsEnable(); } }