예제 #1
0
        // Button to load an image for treatment
        private void OnButtonLoadClick(object sender, EventArgs e)
        {
            // Open file explorer dialog to choose an image
            OpenFileDialog ofd = new OpenFileDialog
            {
                Title  = "Select an image file",
                Filter = "Png Images(*.png)|*.png|Jpeg Images(*.jpg)|*.jpg|Bitmap Images(*.bmp)|*.bmp"
            };

            // If OK is clicked
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                // Loads an image from the image controller
                bool imageLoaded = imageController.LoadImage(ofd.FileName);

                if (imageLoaded)
                {
                    // Reset filters and update image
                    ResetFilters();
                    ResetEdgeDetections();
                    UpdatePreviewImage();

                    //if image correctly loaded we can add filters or save the new picture
                    ToggleFilters(true);
                    buttonSave.Enabled          = true;
                    checkboxFiltersDone.Enabled = true;
                }
            }
        }