private void AdvancedResizeCallback(object sender, EventArgs e)
        {
            var form = new ResizeForm(1024, 768);

            form.passResult += PerformResize;
            form.ShowDialog();
        }
Пример #2
0
 public void ResizeForm()
 {
     using (var frm = new ResizeForm())
     {
         UnitTestWinFormHelper.ShowFormAndClose(frm, .2, (from) =>
         {
             CsvTools.ResizeForm.SetFonts(from, SystemFonts.DialogFont);
         });
     }
 }
Пример #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="form"></param>
 private void GetParams(ResizeForm form)
 {
     if (form is Form)
     {
         Params["Width"]  = form.ParamWidth;
         Params["Height"] = form.ParamHeight;
         Params["Aspect"] = form.ParamAspect;
         Params["Method"] = form.ParamMethod;
     }
 }
Пример #4
0
        /// <summary>
        ///
        /// </summary>
        public DialogResult Show(Form parent = null, bool setup = false)
        {
            if (fm == null)
            {
                fm                 = new ResizeForm(this);
                fm.host            = Host;
                fm.Text            = DisplayName;
                fm.FormBorderStyle = FormBorderStyle.FixedToolWindow;
                fm.MaximizeBox     = false;
                fm.MinimizeBox     = false;
                fm.ShowIcon        = false;
                fm.ShowInTaskbar   = false;
                fm.StartPosition   = FormStartPosition.CenterParent;

                Translate(fm);

                if (setup)
                {
                    if (Params.ContainsKey("Width") && Params.ContainsKey("Height"))
                    {
                        SetParams(fm, null);
                    }
                    else
                    {
                        SetParams(fm, ImgSrc);
                    }
                }
                else if (ImgSrc != null)
                {
                    SetParams(fm, ImgSrc);
                }
            }
            var result = fm.ShowDialog();

            if (result == DialogResult.OK)
            {
                _success = true;
                GetParams(fm);
                if (!setup)
                {
                    ImgDst = Apply(ImgSrc);
                }
            }
            if (fm != null)
            {
                fm.Dispose();
                fm = null;
            }
            return(result);
        }
Пример #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="form"></param>
        /// <param name="img"></param>
        private void SetParams(ResizeForm form, System.Drawing.Image img = null)
        {
            if (img is System.Drawing.Image)
            {
                form.ParamWidth = new ParamItem()
                {
                    Name        = "Width",
                    DisplayName = AddinUtils._(this, "Width"),
                    Type        = ImgSrc.Width.GetType(),
                    Value       = ImgSrc.Width
                };
                form.ParamHeight = new ParamItem()
                {
                    Name        = "Height",
                    DisplayName = AddinUtils._(this, "Height"),
                    Type        = ImgSrc.Height.GetType(),
                    Value       = ImgSrc.Height
                };
            }
            else
            {
                if (Params.ContainsKey("Width"))
                {
                    form.ParamWidth = Params["Width"];
                }

                if (Params.ContainsKey("Height"))
                {
                    form.ParamHeight = Params["Height"];
                }
            }
            if (Params.ContainsKey("Aspect"))
            {
                form.ParamAspect = Params["Aspect"];
            }

            if (Params.ContainsKey("Method"))
            {
                form.ParamMethod = Params["Method"];
            }
        }
Пример #6
0
        private void watermarkToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ResizeForm resizeForm = new ResizeForm();

            resizeForm.ShowDialog(this);
        }