Inheritance: System.Windows.Forms.Form
コード例 #1
0
 private static InputFormResult GetResult(InputForm currForm)
 {
     if (currForm.bCanceled)
     {
         return(new InputFormResult(DialogResult.Cancel));
     }
     else
     {
         return(new InputFormResult(DialogResult.OK, currForm.txtInput.Text));
     }
 }
コード例 #2
0
		private static InputFormResult GetResult(InputForm currForm)
		{
			if (currForm.bCanceled)
			{
				return new InputFormResult(DialogResult.Cancel);
			}
			else
			{
				return new InputFormResult(DialogResult.OK, currForm.txtInput.Text);
			}
		}
コード例 #3
0
		public static InputFormResult ShowModal(System.Windows.Forms.IWin32Window owner, string caption, string title, string defaultText)
		{
			InputForm theForm = new InputForm();
			theForm.InitializeComponent();
			theForm.lblCaption.Text = caption;
			theForm.Text = title;
			theForm.txtInput.Text = defaultText;
			theForm.ShowDialog(owner);
		
			return GetResult(theForm);
		}	
コード例 #4
0
        public static InputFormResult ShowModal(System.Windows.Forms.IWin32Window owner, string caption, string title, string defaultText)
        {
            InputForm theForm = new InputForm();

            theForm.InitializeComponent();
            theForm.lblCaption.Text = caption;
            theForm.Text            = title;
            theForm.txtInput.Text   = defaultText;
            theForm.ShowDialog(owner);

            return(GetResult(theForm));
        }
コード例 #5
0
		private static void SizeCaption(InputForm currForm, string caption)
		{
			// Work out how big the text will be.
			SizeF layoutSize = new SizeF (currForm.lblCaption.Width, SystemInformation.WorkingArea.Height);
			System.Drawing.Graphics grph = System.Drawing.Graphics.FromHwnd(currForm.Handle);
			SizeF stringSize = grph.MeasureString(caption, currForm.lblCaption.Font, layoutSize);

            // Resize the caption label and other controls appropriately.
			if ( ((int) stringSize.Height) > currForm.lblCaption.Height)
			{
				currForm.SuspendLayout();
				currForm.lblCaption.Height = ((int) stringSize.Height) + 4;
				currForm.txtInput.Top = currForm.lblCaption.Bottom + 12;
				currForm.btnCancel.Top = currForm.txtInput.Bottom + 8;
				currForm.btnOK.Top = currForm.btnCancel.Top;
				currForm.Height = currForm.btnOK.Bottom + (30);
				currForm.ResumeLayout(true);				
			}
		}
コード例 #6
0
        private static void SizeCaption(InputForm currForm, string caption)
        {
            // Work out how big the text will be.
            SizeF layoutSize = new SizeF(currForm.lblCaption.Width, SystemInformation.WorkingArea.Height);

            System.Drawing.Graphics grph = System.Drawing.Graphics.FromHwnd(currForm.Handle);
            SizeF stringSize             = grph.MeasureString(caption, currForm.lblCaption.Font, layoutSize);

            // Resize the caption label and other controls appropriately.
            if (((int)stringSize.Height) > currForm.lblCaption.Height)
            {
                currForm.SuspendLayout();
                currForm.lblCaption.Height = ((int)stringSize.Height) + 4;
                currForm.txtInput.Top      = currForm.lblCaption.Bottom + 12;
                currForm.btnCancel.Top     = currForm.txtInput.Bottom + 8;
                currForm.btnOK.Top         = currForm.btnCancel.Top;
                currForm.Height            = currForm.btnOK.Bottom + (30);
                currForm.ResumeLayout(true);
            }
        }