private void Load_Click(object sender, EventArgs e) { if (ImageLoaded && ControlLocked) { return; } OpenFileDialog openFile = new OpenFileDialog(); openFile.ShowDialog(); string FileName = openFile.FileName; if (FileName != "") { LoadedImage = new Bitmap((Bitmap)Image.FromFile(FileName)); Pbox.SetImageOnCenter = true; NewImage = LoadedImage; ControlLocked = false; ImageLoaded = true; if (LoadedImage.Width >= LoadedImage.Height * (float)Pbox.Width / (float)Pbox.Height) { Pbox.Zoom = (float)Pbox.Size.Width / (float)LoadedImage.Width; } else { Pbox.Zoom = (float)Pbox.Size.Height / (float)LoadedImage.Height; } Pbox.SetImageOnCenter = true; Pbox.Image = LoadedImage; Pbox.ResizeImage(); ResizedImage = Pbox.GetImage(); if (group_ColorPanels.Controls.Count == 0 || group_WorkPanels.Controls.Count == 0) { CreateWorkPanels(5, DefaulfList); CreateColorPanels(20, DefaulfList); } else { ChangeColorPanels(DefaulfList); ChangeWorkPanels(5, DefaulfList); } targetColor.BackColor = Font_Color; } TargetRGB = Font_Color; ConvertType = "RGB"; ChangeNeeded = false; SetRGB(); ConvertColor(); Pbox.Focus(); }
private void Save_Click(object sender, EventArgs e) { if (!ImageLoaded || ControlLocked) { return; } SaveFileDialog sfd = new SaveFileDialog(); if (sfd.ShowDialog() == DialogResult.OK) { Bitmap saveImg = ImageHandler.PrepareForSave(LoadedImage); saveImg.Save(sfd.FileName + ".jpg", System.Drawing.Imaging.ImageFormat.Bmp); } Pbox.Focus(); }