Example #1
0
        public static Histogram_InfoPanel GetResult(Color ForeColor)
        {
            Histogram_InfoPanel result = new Histogram_InfoPanel()
            {
                pipe_0   = Get_pipe("0"),
                pipe_64  = Get_pipe("64"),
                pipe_128 = Get_pipe("128"),
                pipe_192 = Get_pipe("192"),
                pipe_255 = Get_pipe("255"),

                MostValue           = Get_Label("Most Value:  "),
                MostValue_Index     = Get_Label(""),
                MostValue_Quantity  = Get_Label(""),
                LeastValue          = Get_Label("Least Value:  "),
                LeastValue_Index    = Get_Label(""),
                LeastValue_Quantity = Get_Label(""),

                MaxValue = Get_Label("Max Value:  "),
                MinValue = Get_Label("Min Value:  ")
            };

            result.Histogram = Histogram_Builder.GetResult(ForeColor);
            //result.Histogram = new Histogram(ForeColor);

            result.MostValue_Color  = Get_ColorPanel();
            result.LeastValue_Color = Get_ColorPanel();


            result.Height = result.Histogram.Height + 20;
            result.Dock   = DockStyle.Fill;

            result.Controls.AddRange(new Control[]
            {
                result.Histogram,
                result.MostValue,
                result.MostValue_Index,
                result.MostValue_Quantity,
                result.MostValue_Color,
                result.LeastValue,
                result.LeastValue_Index,
                result.LeastValue_Quantity,
                result.LeastValue_Color,

                result.MaxValue,
                result.MinValue
            });

            result.Controls.AddRange(new Control[] {
                result.pipe_0,
                result.pipe_64,
                result.pipe_128,
                result.pipe_192,
                result.pipe_255
            });

            Configure_PipePosition(ref result);

            return(result);
        }
        public override IPopup GetResult()
        {
            int       extraMargin      = 5;
            Histogram toScaleHistogram = Histogram_Builder.GetResult(Color.White);
            int       HistogramWidth   = toScaleHistogram.Width;

            EdgeDetectionLaplacePopup result = new EdgeDetectionLaplacePopup
            {
                form      = new Form(),
                Ok_Button = new Button()
                {
                    Text = "ok"
                },
                Cancel_Button = new Button()
                {
                    Text = "cancel"
                },
                Aply_Button = new Button()
                {
                    Text = "apply"
                },

                apertureSize_Text = new Label()
                {
                    Text = "aperture size:   [1 < a < 31]   and   [a % 2 == 1]"
                },
                apertureSize       = new TrackBar(),
                apertureSize_Value = new Label()
            };

            FlowLayoutPanel ButtonContainer = new FlowLayoutPanel()
            {
                Dock          = DockStyle.Bottom,
                Height        = result.Ok_Button.Height + extraMargin,
                FlowDirection = FlowDirection.RightToLeft,
                WrapContents  = false
            };

            result.apertureSize_Text.Left = extraMargin;
            result.apertureSize.Left      = extraMargin;

            result.form.FormClosing += result.Form_FormClosing;

            result.Ok_Button.Click     += result.Ok_Button_Click;
            result.Cancel_Button.Click += result.Cancel_Button_Click;
            result.Aply_Button.Click   += result.Aply_Button_Click;


            result.apertureSize_Text.Height = ButtonContainer.Height / 2;
            result.apertureSize_Text.Width  = HistogramWidth;
            result.apertureSize_Text.Top    = extraMargin;

            result.apertureSize.Height = ButtonContainer.Height / 2;
            result.apertureSize.Width  = HistogramWidth;
            result.apertureSize.Top    = result.apertureSize_Text.Top
                                         + result.apertureSize_Text.Height;

            result.apertureSize_Value.Left = HistogramWidth + extraMargin;
            result.apertureSize_Value.Top  = result.apertureSize.Top;

            result.apertureSize.ValueChanged += result.Value_ValueChanged;

            result.form.Height = ButtonContainer.Height
                                 + ButtonContainer.Height * 2
                                 + 64;
            result.form.Width = HistogramWidth
                                + result.apertureSize_Value.Width
                                + extraMargin * 3;

            result.form.Controls.Add(result.apertureSize_Text);
            result.form.Controls.Add(result.apertureSize);
            result.form.Controls.Add(result.apertureSize_Value);

            result.form.Controls.Add(ButtonContainer);
            ButtonContainer.Controls.Add(result.Aply_Button);
            ButtonContainer.Controls.Add(result.Cancel_Button);
            ButtonContainer.Controls.Add(result.Ok_Button);
            //result.form.Show();

            return(result);
        }
        public override IPopup GetResult()
        {
            int       extraMargin      = 5;
            Histogram toScaleHistogram = Histogram_Builder.GetResult(Color.White);
            int       HistogramWidth   = toScaleHistogram.Width;


            SingleParamPopup result = new SingleParamPopup
            {
                form      = new Form(),
                Ok_Button = new Button()
                {
                    Text = "ok"
                },
                Cancel_Button = new Button()
                {
                    Text = "cancel"
                },
                Aply_Button = new Button()
                {
                    Text = "apply"
                },

                value       = new TrackBar(),
                value_Value = new Label(),

                ifMaxValue = new CheckBox()
            };

            FlowLayoutPanel ButtonContainer = new FlowLayoutPanel()
            {
                Dock          = DockStyle.Bottom,
                Height        = result.Ok_Button.Height + extraMargin,
                FlowDirection = FlowDirection.RightToLeft,
                WrapContents  = false
            };

            result.value.Left = extraMargin;

            result.form.FormClosing += result.Form_FormClosing;

            result.Ok_Button.Click     += result.Ok_Button_Click;
            result.Cancel_Button.Click += result.Cancel_Button_Click;
            result.Aply_Button.Click   += result.Aply_Button_Click;

            result.value.Height = ButtonContainer.Height / 2;
            result.value.Width  = HistogramWidth;
            result.value.Top    = extraMargin;


            result.value.ValueChanged += result.Value_ValueChanged;

            result.form.Height = ButtonContainer.Height
                                 + result.value.Height
                                 + 64;
            result.form.Width = HistogramWidth
                                + result.value_Value.Width
                                + extraMargin * 3;

            result.value_Value.Top  = result.value.Top;
            result.value_Value.Left = result.value.Width + extraMargin;


            result.form.Controls.Add(result.value);
            result.form.Controls.Add(result.value_Value);

            result.form.Controls.Add(ButtonContainer);
            ButtonContainer.Controls.Add(result.Aply_Button);
            ButtonContainer.Controls.Add(result.Cancel_Button);
            ButtonContainer.Controls.Add(result.Ok_Button);
            //result.form.Show();

            return(result);
        }
        public override IPopup GetResult()
        {
            int       extraMargin      = 5;
            Histogram toScaleHistogram = Histogram_Builder.GetResult(Color.White);
            int       HistogramHeight  = toScaleHistogram.Height;
            int       HistogramWidth   = toScaleHistogram.Width;


            ChooseSecondImagePopup result = new ChooseSecondImagePopup
            {
                form         = new Form(),
                BrowseButton = new Button()
                {
                    Text = "Browse Second Image", AutoSize = true
                },

                Ok_Button = new Button()
                {
                    Text = "ok"
                },
                Cancel_Button = new Button()
                {
                    Text = "cancel"
                },
                Aply_Button = new Button()
                {
                    Text = "apply"
                },

                dragNdropContainer = new Panel()
                {
                    AllowDrop = true, Dock = DockStyle.Top
                },
                dragNdropText1 = Get_dragNdropLabel("Drop your image here", 26),
                dragNdropText2 = Get_dragNdropLabel("[ bmp, jpg, png, tiff ]", 13),

                valuebar      = new TrackBar(),
                valuebar_Text = new Label(),
                FileNameLabel = new Label()
                {
                    Text = "Choose Second Image!", AutoSize = true
                },
            };

            FlowLayoutPanel ButtonContainer = new FlowLayoutPanel()
            {
                Dock          = DockStyle.Bottom,
                Height        = result.Ok_Button.Height + extraMargin,
                FlowDirection = FlowDirection.RightToLeft,
                WrapContents  = false
            };



            result.form.Resize      += result.Form_Resize;
            result.form.FormClosing += result.Form_FormClosing;

            result.Ok_Button.Click     += result.Ok_Button_Click;
            result.Cancel_Button.Click += result.Cancel_Button_Click;
            result.Aply_Button.Click   += result.Aply_Button_Click;

            result.dragNdropContainer.Height = HistogramHeight * 2 / 3;

            result.BrowseButton.Top  = result.dragNdropContainer.Bottom + extraMargin;
            result.BrowseButton.Left = extraMargin;

            result.FileNameLabel.Top  = result.BrowseButton.Bottom + extraMargin;
            result.FileNameLabel.Left = extraMargin;


            result.form.Height = result.dragNdropContainer.Height
                                 + HistogramHeight / 2
                                 + 64;
            result.form.Width = HistogramWidth
                                + result.valuebar_Text.Width
                                + extraMargin * 3;


            result.valuebar.ValueChanged += result.Value_ValueChanged;

            result.BrowseButton.Click           += result.Open_tsmi_Click;
            result.dragNdropContainer.DragDrop  += result.DragNdropContainer_DragDrop;
            result.dragNdropContainer.DragEnter += result.DragNdropContainer_DragEnter;
            //result.dragNdropContainer.MouseMove += result.MouseFix_MouseMove;


            result.form.Controls.Add(result.valuebar);
            result.form.Controls.Add(result.valuebar_Text);


            result.form.Controls.Add(result.FileNameLabel);
            result.form.Controls.Add(result.BrowseButton);
            result.form.Controls.Add(result.dragNdropContainer);
            result.dragNdropContainer.Controls.Add(result.dragNdropText1);
            result.dragNdropContainer.Controls.Add(result.dragNdropText2);

            result.form.Controls.Add(ButtonContainer);
            ButtonContainer.Controls.Add(result.Aply_Button);
            ButtonContainer.Controls.Add(result.Cancel_Button);
            ButtonContainer.Controls.Add(result.Ok_Button);

            result.valuebar.Height = ButtonContainer.Height / 2;
            result.valuebar.Width  = HistogramWidth;
            result.valuebar.Top    = ButtonContainer.Top
                                     - result.valuebar.Height
                                     - extraMargin;

            result.valuebar_Text.Left = HistogramWidth + extraMargin;
            result.valuebar_Text.Top  = result.valuebar.Top;

            return(result);
        }
        public override IPopup GetResult()
        {
            int       extraMargin      = 5;
            Histogram toScaleHistogram = Histogram_Builder.GetResult(Color.White);
            int       HistogramWidth   = toScaleHistogram.Width;
            // anchor.x  >=  0
            // anchor.x  <  k.Width
            // anchor.y  >=  0
            // anchor.Y  <  k.Height

            BlurPopup result = new BlurPopup
            {
                form      = new Form(),
                Ok_Button = new Button()
                {
                    Text = "ok"
                },
                Cancel_Button = new Button()
                {
                    Text = "cancel"
                },
                Aply_Button = new Button()
                {
                    Text = "apply"
                },

                widthValue_Text = new Label()
                {
                    Text = "ksize width:   "
                },
                HeightValue_Text = new Label()
                {
                    Text = "ksize height:   "
                },
                xposValue_Text = new Label()
                {
                    Text = "anchor xpos:      < 0 ; ksize width ]"
                },
                yposValue_Text = new Label()
                {
                    Text = "anchor ypos:      < 0 ; ksize height ]"
                },
                // anchor.x  >=  0
                // anchor.x  <  k.Width
                // anchor.y  >=  0
                // anchor.Y  <  k.Height

                widthValue  = new TrackBar(),
                HeightValue = new TrackBar(),
                xposValue   = new TrackBar(),
                yposValue   = new TrackBar(),

                widthValue_Value  = new Label(),
                HeightValue_Value = new Label(),
                xposValue_Value   = new Label(),
                yposValue_Value   = new Label()
            };

            FlowLayoutPanel ButtonContainer = new FlowLayoutPanel()
            {
                Dock          = DockStyle.Bottom,
                Height        = result.Ok_Button.Height + extraMargin,
                FlowDirection = FlowDirection.RightToLeft,
                WrapContents  = false
            };

            result.widthValue_Text.Left  = extraMargin;
            result.HeightValue_Text.Left = extraMargin;
            result.xposValue_Text.Left   = extraMargin;
            result.yposValue_Text.Left   = extraMargin;

            result.widthValue.Left  = extraMargin;
            result.HeightValue.Left = extraMargin;
            result.xposValue.Left   = extraMargin;
            result.yposValue.Left   = extraMargin;

            result.form.FormClosing += result.Form_FormClosing;

            result.Ok_Button.Click     += result.Ok_Button_Click;
            result.Cancel_Button.Click += result.Cancel_Button_Click;
            result.Aply_Button.Click   += result.Aply_Button_Click;



            result.widthValue_Text.Height = ButtonContainer.Height / 2;
            result.widthValue_Text.Width  = HistogramWidth;
            result.widthValue_Text.Top    = extraMargin;
            result.widthValue.Height      = ButtonContainer.Height / 2;
            result.widthValue.Width       = HistogramWidth;
            result.widthValue.Top         = result.widthValue_Text.Top
                                            + result.widthValue_Text.Height;
            result.HeightValue_Text.Height = ButtonContainer.Height / 2;
            result.HeightValue_Text.Width  = HistogramWidth;
            result.HeightValue_Text.Top    = result.widthValue.Top
                                             + result.widthValue.Height;
            result.HeightValue.Height = ButtonContainer.Height / 2;
            result.HeightValue.Width  = HistogramWidth;
            result.HeightValue.Top    = result.HeightValue_Text.Top
                                        + result.HeightValue_Text.Height;
            result.xposValue_Text.Height = ButtonContainer.Height / 2;
            result.xposValue_Text.Width  = HistogramWidth;
            result.xposValue_Text.Top    = result.HeightValue.Top
                                           + result.HeightValue.Height;
            result.xposValue.Height = ButtonContainer.Height / 2;
            result.xposValue.Width  = HistogramWidth;
            result.xposValue.Top    = result.xposValue_Text.Top
                                      + result.xposValue_Text.Height;
            result.yposValue_Text.Height = ButtonContainer.Height / 2;
            result.yposValue_Text.Width  = HistogramWidth;
            result.yposValue_Text.Top    = result.xposValue.Top
                                           + result.xposValue.Height;
            result.yposValue.Height = ButtonContainer.Height / 2;
            result.yposValue.Width  = HistogramWidth;
            result.yposValue.Top    = result.yposValue_Text.Top
                                      + result.yposValue_Text.Height;



            result.widthValue_Value.Left  = HistogramWidth + extraMargin;
            result.HeightValue_Value.Left = HistogramWidth + extraMargin;
            result.xposValue_Value.Left   = HistogramWidth + extraMargin;
            result.yposValue_Value.Left   = HistogramWidth + extraMargin;

            result.widthValue_Value.Top  = result.widthValue.Top;
            result.HeightValue_Value.Top = result.HeightValue.Top;
            result.xposValue_Value.Top   = result.xposValue.Top;
            result.yposValue_Value.Top   = result.yposValue.Top;


            result.widthValue.ValueChanged  += result.Value_ValueChanged;
            result.HeightValue.ValueChanged += result.Value_ValueChanged;
            result.xposValue.ValueChanged   += result.Value_ValueChanged;
            result.yposValue.ValueChanged   += result.Value_ValueChanged;


            result.form.Height = ButtonContainer.Height
                                 + ButtonContainer.Height * 8
                                 + 64;
            result.form.Width = HistogramWidth
                                + result.widthValue_Value.Width
                                + extraMargin * 3;

            result.form.Controls.Add(result.widthValue_Text);
            result.form.Controls.Add(result.HeightValue_Text);
            result.form.Controls.Add(result.xposValue_Text);
            result.form.Controls.Add(result.yposValue_Text);

            result.form.Controls.Add(result.widthValue);
            result.form.Controls.Add(result.HeightValue);
            result.form.Controls.Add(result.xposValue);
            result.form.Controls.Add(result.yposValue);


            result.form.Controls.Add(result.widthValue_Value);
            result.form.Controls.Add(result.HeightValue_Value);
            result.form.Controls.Add(result.xposValue_Value);
            result.form.Controls.Add(result.yposValue_Value);

            result.form.Controls.Add(ButtonContainer);
            ButtonContainer.Controls.Add(result.Aply_Button);
            ButtonContainer.Controls.Add(result.Cancel_Button);
            ButtonContainer.Controls.Add(result.Ok_Button);
            //result.form.Show();

            return(result);
        }