当前位置: 首页>>代码示例>>C#>>正文


C# Form.PerformLayout方法代码示例

本文整理汇总了C#中System.Windows.Forms.Form.PerformLayout方法的典型用法代码示例。如果您正苦于以下问题:C# Form.PerformLayout方法的具体用法?C# Form.PerformLayout怎么用?C# Form.PerformLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.Form的用法示例。


在下文中一共展示了Form.PerformLayout方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AskForPassword

        public static string AskForPassword()
        {
            Form dialog = new Form();
            dialog.FormBorderStyle = FormBorderStyle.FixedDialog;

            System.Windows.Forms.Label label1;
            MarkJohansen.Forms.MSJTextBox msjTextBox1;
            MarkJohansen.Forms.MSJButton msjButton1;

            label1 = new System.Windows.Forms.Label();
            msjTextBox1 = new MarkJohansen.Forms.MSJTextBox();
            msjButton1 = new MarkJohansen.Forms.MSJButton();
            dialog.SuspendLayout();
            //
            // label1
            //
            label1.AutoSize = true;
            label1.Location = new System.Drawing.Point(2, 8);
            label1.Name = "label1";
            label1.Size = new System.Drawing.Size(160, 13);
            label1.TabIndex = 0;
            label1.Text = "Please enter your DM password.";
            //
            // msjTextBox1
            //
            msjTextBox1.Location = new System.Drawing.Point(5, 25);
            msjTextBox1.Name = "msjTextBox1";
            msjTextBox1.Size = new System.Drawing.Size(285, 20);
            msjTextBox1.TabIndex = 1;
            //
            // msjButton1
            //
            msjButton1.Location = new System.Drawing.Point(5, 51);
            msjButton1.Name = "msjButton1";
            msjButton1.Size = new System.Drawing.Size(285, 28);
            msjButton1.TabIndex = 2;
            msjButton1.Text = "OK";
            msjButton1.Click += (sender, e) => { dialog.Close(); };
            msjButton1.UseVisualStyleBackColor = true;
            //
            // Form1
            //
            dialog.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            dialog.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            dialog.ClientSize = new System.Drawing.Size(292, 84);
            dialog.Controls.Add(msjButton1);
            dialog.Controls.Add(msjTextBox1);
            dialog.Controls.Add(label1);
            dialog.Name = "Form1";
            dialog.Text = "Form1";
            dialog.ResumeLayout(false);
            dialog.PerformLayout();

            dialog.ShowDialog();

            return msjTextBox1.Text;
        }
开发者ID:msjohansen,项目名称:RavenloftLauncher,代码行数:57,代码来源:Pompt.cs

示例2: InputBox

        public static string InputBox(string Prompt = "", string Title = "", string DefaultResponse = "")
        {
            var textBox = new TextBox();
            textBox.Location = new Point(12, 84);
            textBox.Size = new Size(329, 19);
            textBox.Text = DefaultResponse;

            var okButton = new Button();
            okButton.DialogResult = DialogResult.OK;
            okButton.Location = new Point(266, 9);
            okButton.Size = new Size(75, 23);
            okButton.Text = "OK";
            okButton.UseVisualStyleBackColor = true;

            var cancelButton = new Button();
            cancelButton.DialogResult = DialogResult.Cancel;
            cancelButton.Location = new Point(266, 38);
            cancelButton.Size = new Size(75, 23);
            cancelButton.Text = "キャンセル";
            cancelButton.UseVisualStyleBackColor = true;

            var label = new Label();
            label.AutoSize = true;
            label.Location = new Point(12, 9);
            label.Size = new Size(0, 12);
            label.Text = Prompt;

            var form = new Form();
            form.SuspendLayout();
            form.AcceptButton = okButton;
            form.CancelButton = cancelButton;
            form.AutoScaleDimensions = new SizeF(6F, 12F);
            form.AutoScaleMode = AutoScaleMode.Font;
            form.ClientSize = new Size(353, 120);
            form.ControlBox = false;
            form.Controls.Add(textBox);
            form.Controls.Add(okButton);
            form.Controls.Add(cancelButton);
            form.Controls.Add(label);
            form.FormBorderStyle = FormBorderStyle.FixedDialog;
            form.ShowInTaskbar = false;
            form.StartPosition = FormStartPosition.CenterParent;
            form.ResumeLayout(false);
            form.PerformLayout();
            form.Text = Title;

            if (form.ShowDialog() == DialogResult.OK) return textBox.Text;
            else return null;
        }
开发者ID:1995hnagamin,项目名称:Pidet,代码行数:49,代码来源:main.cs

示例3: LabelManager

 public LabelManager(Form p, int m)
 {
     maxNumItems = m;
     items = new List<ResultItem>(0);
     labels = new Label[maxNumItems];
     p.SuspendLayout();
     for (int i = 0; i < maxNumItems; i++)
     {
         labels[i] = new Label();
         labels[i].AutoEllipsis = true;
         labels[i].BackColor = Color.White;
         labels[i].Font = new Font("Microsoft Sans Serif", 18F, FontStyle.Regular, GraphicsUnit.Point, 0);
         labels[i].Location = new Point(100, 110 + (i * 50));
         labels[i].Size = new Size(1050, 30);
         labels[i].TextAlign = ContentAlignment.MiddleCenter;
         p.Controls.Add(labels[i]);
     }
     p.ResumeLayout();
     p.PerformLayout();
 }
开发者ID:henderea,项目名称:PopupMultibox,代码行数:20,代码来源:LabelManager.cs

示例4: ResumeLayoutEffects

		public void ResumeLayoutEffects ()
		{
			Form f = new Form ();
			f.ShowInTaskbar = false;
			f.ClientSize = new Size (300, 300);
			
			Button button1 = new Button ();
			f.Controls.Add (button1);
			button1.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
			button1.Location = new Point (f.ClientSize.Width - button1.Width, f.ClientSize.Height - button1.Height);

			f.Show ();
			
			Assert.AreEqual (new Point (225, 277), button1.Location, "A1");
			
			f.SuspendLayout ();
			f.Height += 10;
			f.ResumeLayout (false);
			f.PerformLayout ();

			Assert.AreEqual (new Point (225, 277), button1.Location, "A2");

			f.SuspendLayout ();
			f.Height += 10;
			f.ResumeLayout ();

			Assert.AreEqual (new Point (225, 287), button1.Location, "A3");
			f.Dispose ();
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:29,代码来源:ControlTest.cs

示例5: ShowUI

        static DialogResult ShowUI(string title, string promptText, string value, bool password = false)
        {
            Form form = new Form();
            Label label = new Label();
            TextBox textBox = new TextBox();
            if (password)
                textBox.UseSystemPasswordChar = true;
            MyButton buttonOk = new MyButton();
            MyButton buttonCancel = new MyButton();
            //System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainV2));
            //form.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));

            // Suspend form layout.
            form.SuspendLayout();
            const int yMargin = 10;

            //
            // label
            //
            var y = 20;
            label.AutoSize = true;
            label.Location = new Point(9, y);
            label.Size = new Size(372, 13);
            label.Text = promptText;
            label.MaximumSize = new Size(372, 0);

            //
            // textBox
            //
            textBox.Size = new Size(372, 20);
            textBox.Text = value;
            textBox.TextChanged += textBox_TextChanged;

            //
            // buttonOk
            //
            buttonOk.Size = new Size(75, 23);
            buttonOk.Text = "OK";
            buttonOk.DialogResult = DialogResult.OK;
            
            //
            // buttonCancel
            //
            buttonCancel.Size = new Size(75, 23);
            buttonCancel.Text = "Cancel";
            buttonCancel.DialogResult = DialogResult.Cancel;
            
            //
            // form
            //
            form.TopMost = true;
            form.TopLevel = true;
            form.Text = title;
            form.ClientSize = new Size(396, 107);
            form.Controls.AddRange(new Control[] { label, textBox, buttonOk, buttonCancel });
            form.FormBorderStyle = FormBorderStyle.FixedSingle;
            form.StartPosition = FormStartPosition.CenterScreen;
            form.MinimizeBox = false;
            form.MaximizeBox = false;
            form.AcceptButton = buttonOk;
            form.CancelButton = buttonCancel;

            // Resume form layout
            form.ResumeLayout(false);
            form.PerformLayout();

            // Adjust the location of textBox, buttonOk, buttonCancel based on the content of the label.
            y = y + label.Height + yMargin;
            textBox.Location = new Point(12, y);
            y = y + textBox.Height + yMargin;
            buttonOk.Location = new Point(228, y);
            buttonCancel.Location = new Point(309, y);
            // Increase the size of the form.
            form.ClientSize = new Size(396, y + buttonOk.Height + yMargin);

            if (ApplyTheme != null)
                ApplyTheme(form);
            

            Console.WriteLine("Input Box " + System.Threading.Thread.CurrentThread.Name);

            Application.DoEvents();

            form.ShowDialog();

            Console.WriteLine("Input Box 2 " + System.Threading.Thread.CurrentThread.Name);

            DialogResult dialogResult = form.DialogResult;

            if (dialogResult == DialogResult.OK)
            {
                value = textBox.Text;
                InputBox.value = value;
            }

            form.Dispose();

            TextChanged = null;

            form = null;
//.........这里部分代码省略.........
开发者ID:duyisu,项目名称:MissionPlanner,代码行数:101,代码来源:InputBox.cs

示例6: NumericInputBox

        public static int NumericInputBox(string Prompt = "", string Title = "", int DefaultResponse = 0, int MinValue = 0, int MaxValue = 100)
        {
            var nud = new NumericUpDown();
            nud.Location = new Point(12, 84);
            nud.Size = new Size(100, 19);
            nud.Minimum = MinValue;
            nud.Maximum = MaxValue;
            nud.Value = DefaultResponse;

            var okButton = new Button();
            okButton.DialogResult = DialogResult.OK;
            okButton.Location = new Point(266, 9);
            okButton.Size = new Size(75, 23);
            okButton.Text = "OK";
            okButton.UseVisualStyleBackColor = true;

            var cancelButton = new Button();
            cancelButton.DialogResult = DialogResult.Cancel;
            cancelButton.Location = new Point(266, 38);
            cancelButton.Size = new Size(75, 23);
            cancelButton.Text = "キャンセル";
            cancelButton.UseVisualStyleBackColor = true;

            var label = new Label();
            label.AutoSize = true;
            label.Location = new Point(12, 9);
            label.Size = new Size(0, 12);
            label.Text = Prompt;

            var form = new Form();
            form.SuspendLayout();
            form.AcceptButton = okButton;
            form.CancelButton = cancelButton;
            form.AutoScaleDimensions = new SizeF(6F, 12F);
            form.AutoScaleMode = AutoScaleMode.Font;
            form.ClientSize = new Size(353, 120);
            form.ControlBox = false;
            form.Controls.Add(nud);
            form.Controls.Add(okButton);
            form.Controls.Add(cancelButton);
            form.Controls.Add(label);
            form.FormBorderStyle = FormBorderStyle.FixedDialog;
            form.ShowInTaskbar = false;
            form.StartPosition = FormStartPosition.CenterParent;
            form.ResumeLayout(false);
            form.PerformLayout();
            form.Text = Title;

            if (form.ShowDialog() == DialogResult.OK) return (int)nud.Value;
            else return 0;
        }
开发者ID:1995hnagamin,项目名称:Pidet,代码行数:51,代码来源:main.cs

示例7: TestPublicMethods

		public void TestPublicMethods ()
		{
			// Public Methods that force Handle creation:
			// - CreateGraphics ()
			// - GetChildAtPoint ()
			// - Invoke, BeginInvoke throws InvalidOperationException if Handle has not been created
			// - PointToClient ()
			// - PointToScreen ()
			// - RectangleToClient ()
			// - RectangleToScreen ()
			// - Select ()
			// - Show (IWin32Window)
			// Notes:
			// - CreateControl does NOT force Handle creation!
			
			Form c = new Form ();

			c.BringToFront ();
			Assert.IsFalse (c.IsHandleCreated, "A1");
			
			c.Contains (new Form ());
			Assert.IsFalse (c.IsHandleCreated, "A2");
			
			c.CreateControl ();
			Assert.IsFalse (c.IsHandleCreated, "A3");
			
			c = new Form ();
			Graphics g = c.CreateGraphics ();
			g.Dispose ();
			Assert.IsTrue (c.IsHandleCreated, "A4");
			c.Dispose ();
			c = new Form ();
			
			c.Dispose ();
			Assert.IsFalse (c.IsHandleCreated, "A5");
			c = new Form ();

			// This is weird, it causes a form to appear that won't go away until you move the mouse over it, 
			// but it doesn't create a handle??
			//DragDropEffects d = c.DoDragDrop ("yo", DragDropEffects.None);
			//Assert.IsFalse (c.IsHandleCreated, "A6");
			//Assert.AreEqual (DragDropEffects.None, d, "A6b");
			
			//Bitmap b = new Bitmap (100, 100);
			//c.DrawToBitmap (b, new Rectangle (0, 0, 100, 100));
			//Assert.IsFalse (c.IsHandleCreated, "A7");
			//b.Dispose ();
			c.FindForm ();
			Assert.IsFalse (c.IsHandleCreated, "A8");
			
			c.Focus ();
			Assert.IsFalse (c.IsHandleCreated, "A9");

			c.GetChildAtPoint (new Point (10, 10));
			Assert.IsTrue (c.IsHandleCreated, "A10");
			c.Dispose ();
			c = new Form ();
			
			c.GetContainerControl ();
			Assert.IsFalse (c.IsHandleCreated, "A11");
			c.Dispose ();
			
			c = new Form ();
			c.GetNextControl (new Control (), true);
			Assert.IsFalse (c.IsHandleCreated, "A12");
			c.GetPreferredSize (Size.Empty);
			Assert.IsFalse (c.IsHandleCreated, "A13");
			c.Hide ();
			Assert.IsFalse (c.IsHandleCreated, "A14");
			
			c.Invalidate ();
			Assert.IsFalse (c.IsHandleCreated, "A15");
			
			//c.Invoke (new InvokeDelegate (InvokeMethod));
			//Assert.IsFalse (c.IsHandleCreated, "A16");
			c.PerformLayout ();
			Assert.IsFalse (c.IsHandleCreated, "A17");
			
			c.PointToClient (new Point (100, 100));
			Assert.IsTrue (c.IsHandleCreated, "A18");
			c.Dispose ();
			c = new Form ();
			
			c.PointToScreen (new Point (100, 100));
			Assert.IsTrue (c.IsHandleCreated, "A19");
			c.Dispose ();
			
			c = new Form ();
			
			//c.PreProcessControlMessage   ???
			//c.PreProcessMessage          ???
			c.RectangleToClient (new Rectangle (0, 0, 100, 100));
			Assert.IsTrue (c.IsHandleCreated, "A20");
			c.Dispose ();
			c = new Form ();
			c.RectangleToScreen (new Rectangle (0, 0, 100, 100));
			Assert.IsTrue (c.IsHandleCreated, "A21");
			c.Dispose ();
			c = new Form ();
			c.Refresh ();
//.........这里部分代码省略.........
开发者ID:BrzVlad,项目名称:mono,代码行数:101,代码来源:FormHandleTest.cs

示例8: loginPopup

        /*
         * Popup a webbrowser-window with the Oyatel Connect prompt.
         * */
        public void loginPopup()
        {
            _access_token = "";

            popup = new Form();
            canClosePopup = false;
            WebBrowser webBrowser = new WebBrowser();
            popup.SuspendLayout();

            webBrowser.Location = new System.Drawing.Point(0, 0);
            webBrowser.MinimumSize = new System.Drawing.Size(20, 20);
            webBrowser.Name = "webBrowser";
            webBrowser.Size = new System.Drawing.Size(880, 550);

            popup.Width = 900;
            popup.Height = 570;
            popup.Text = "Oyatel Connect";
            popup.Visible = true;

            popup.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            popup.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            popup.ClientSize = new System.Drawing.Size(880, 550);
            popup.Controls.Add(webBrowser);
            popup.Name = "Oyatel.Connect";
            popup.Text = "Oyatel Connect";
            popup.ResumeLayout(false);
            popup.PerformLayout();

            webBrowser.Visible = true;
            webBrowser.Navigated += new WebBrowserNavigatedEventHandler(navigated_event);
            webBrowser.ProgressChanged += new WebBrowserProgressChangedEventHandler(ProgressChanged);
            webBrowser.Navigate("https://oauth.oyatel.com/oauth/authorize?client_id="
                + client_id + "&response_type=token&redirect_uri=" + redirect_uri, false);
        }
开发者ID:Oyatel,项目名称:oyatel-api-examples,代码行数:37,代码来源:Authorize.cs

示例9: Bug81936

		public void Bug81936 ()
		{
			Form f = new Form ();
			f.ShowInTaskbar = false;

			TableLayoutPanel tableLayoutPanel1;
			Label button2;
			Label button4;

			tableLayoutPanel1 = new TableLayoutPanel ();
			button2 = new Label ();
			button4 = new Label ();
			button2.Text = "Test1";
			button4.Text = "Test2";
			button2.Anchor = AnchorStyles.Left;
			button4.Anchor = AnchorStyles.Left;
			button2.Height = 14;
			button4.Height = 14;
			tableLayoutPanel1.SuspendLayout ();
			f.SuspendLayout ();

			tableLayoutPanel1.ColumnCount = 1;
			tableLayoutPanel1.ColumnStyles.Add (new ColumnStyle ());
			tableLayoutPanel1.Controls.Add (button2, 0, 0);
			tableLayoutPanel1.Controls.Add (button4, 0, 1);
			tableLayoutPanel1.Location = new Point (0, 0);
			tableLayoutPanel1.RowCount = 2;
			tableLayoutPanel1.RowStyles.Add (new RowStyle (SizeType.Absolute, 28F));
			tableLayoutPanel1.RowStyles.Add (new RowStyle (SizeType.Absolute, 28F));
			tableLayoutPanel1.Size = new Size (292, 56);

			f.ClientSize = new Size (292, 312);
			f.Controls.Add (tableLayoutPanel1);
			f.Name = "Form1";
			f.Text = "Form1";
			tableLayoutPanel1.ResumeLayout (false);
			tableLayoutPanel1.PerformLayout ();
			f.ResumeLayout (false);
			f.PerformLayout ();

			f.Show ();

			Assert.AreEqual (new Rectangle (3, 7, 100, 14), button2.Bounds, "A1");
			Assert.AreEqual (new Rectangle (3, 35, 100, 14), button4.Bounds, "A2");

			f.Dispose ();
		}
开发者ID:Profit0004,项目名称:mono,代码行数:47,代码来源:TableLayoutTest.cs

示例10: AnchoredAutoSizedControls_SizeInCorrectDirection

		public void AnchoredAutoSizedControls_SizeInCorrectDirection ()
		{
			Form f = new Form ();
			f.ClientSize = new Size (300, 300);
			f.ShowInTaskbar = false;

			Panel p1 = new Panel ();
			p1.Bounds = new Rectangle (150, 150, 0, 0);
			p1.Anchor = AnchorStyles.Top | AnchorStyles.Left;
			p1.AutoSize = true;
			f.Controls.Add (p1);

			Panel p2 = new Panel ();
			p2.Bounds = new Rectangle (150, 150, 0, 0);
			p2.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
			p2.AutoSize = true;
			f.Controls.Add (p2);

			Panel p3 = new Panel ();
			p3.Bounds = new Rectangle (150, 150, 0, 0);
			p3.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right;
			p3.AutoSize = true;
			f.Controls.Add (p3);

			Panel p4 = new Panel ();
			p4.Bounds = new Rectangle (150, 150, 0, 0);
			p4.Anchor = AnchorStyles.None;
			p4.AutoSize = true;
			f.Controls.Add (p4);

			f.Show ();
			// cause the panels to grow
			p1.Controls.Add (new TextBox ());
			p2.Controls.Add (new TextBox ());
			p3.Controls.Add (new TextBox ());
			p4.Controls.Add (new TextBox ());
			f.PerformLayout ();

			Assert.AreEqual (150, p1.Top, "1");
			Assert.AreEqual (150, p1.Left, "2");
			Assert.AreEqual (150, p2.Bottom, "3");
			Assert.AreEqual (150, p2.Right, "4");
			Assert.AreEqual (150, p3.Top, "5");
			Assert.AreEqual (150, p3.Left, "6");
			Assert.AreEqual (150, p4.Top, "7");
			Assert.AreEqual (150, p4.Left, "8");

			f.Dispose ();
		}
开发者ID:Profit0004,项目名称:mono,代码行数:49,代码来源:DefaultLayoutTest.cs

示例11: Main


//.........这里部分代码省略.........
                textBoxOutput.ReadOnly = true;
                textBoxOutput.Size = new Size(363, 150);
                textBoxOutput.TabIndex = 1;
                //
                // statusStrip1
                //
                statusStrip.Items.AddRange(new ToolStripItem[] {statusLabel});
                statusStrip.Location = new Point(0, 238);
                statusStrip.Name = "statusStrip1";
                statusStrip.Size = new Size(363, 22);
                statusStrip.TabIndex = 2;
                statusStrip.Text = "statusStrip1";
                //
                // toolStripStatusLabel1
                //
                statusLabel.Name = "toolStripStatusLabel1";
                statusLabel.Size = new Size(29, 17);
                statusLabel.Spring = true;
                statusLabel.TextAlign = ContentAlignment.MiddleLeft;
                //
                // Form1
                //
                form.AutoScaleDimensions = new SizeF(6F, 12F);
                form.AutoScaleMode = AutoScaleMode.Font;
                form.ClientSize = new Size(363, 260);
                form.Controls.Add(statusStrip);
                form.Controls.Add(panelFill);
                form.Controls.Add(flowLayoutPanelTop);
                form.Name = "Form1";
                form.Text = "二进制打印";
                form.StartPosition = FormStartPosition.CenterScreen;
                form.ImeMode = ImeMode.On;
                flowLayoutPanelTop.ResumeLayout(false);
                flowLayoutPanelTop.PerformLayout();
                panelFill.ResumeLayout(false);
                panelFill.PerformLayout();
                statusStrip.ResumeLayout(false);
                statusStrip.PerformLayout();
                form.ResumeLayout(false);
                form.PerformLayout();
            }

            radioButtonText.Click += (o, e) =>
            {
                textBoxInput.Text = "";
                textBoxOutput.Text = "";

                var commonUse = new List<string>();
                commonUse.Add(Encoding.Unicode.WebName);
                commonUse.Add(Encoding.UTF8.WebName);
                commonUse.Add(Encoding.Default.WebName);
                commonUse.Add(Encoding.UTF7.WebName);
                commonUse.Add(Encoding.UTF32.WebName);

                var fullList = Encoding.GetEncodings().Select(i=>i.GetEncoding().WebName);

                comboBox.DataSource = commonUse.Concat(fullList.Except(commonUse)).ToArray();
            };

            radioButtonNumber.Click += (o, e) =>
            {
                textBoxInput.Text = "";
                textBoxOutput.Text = "";

                comboBox.DataSource = new string[] { "unsigned oct", "signed oct", "hex", };
            };
开发者ID:GHScan,项目名称:DailyProjects,代码行数:67,代码来源:Program.cs

示例12: InitGUI

        /// <summary>
        /// executed in a separate thread - uses spare CPU cycles
        /// </summary>
        protected void InitGUI()
        {
            // Control.CheckForIllegalCrossThreadCalls = false;

            // create consoles for output/input
            // output console is one of the first things to create
            JQuantForms.ConsoleOut consoleOut = new JQuantForms.ConsoleOut();
            consoleOut.Dock = DockStyle.Fill;
            this.consoleOut = consoleOut;

            consoleIn = new JQuantForms.ConsoleIn(new JQuantForms.ConsoleIn.ProcessCommandDelegate(this.ConsoleInCommandHalder));
            consoleIn.Dock = DockStyle.Fill;

            // Create layout
            tlp = new TableLayoutPanel();
            tlp.Dock = DockStyle.Fill;
            tlp.ColumnCount = 1;
            tlp.RowCount = 2;

            tlp.RowStyles.Add(new System.Windows.Forms.RowStyle
                              (System.Windows.Forms.SizeType.Percent, 80F));
            tlp.RowStyles.Add(new System.Windows.Forms.RowStyle
                              (System.Windows.Forms.SizeType.Absolute, 28F));

            // add consoles
            tlp.Controls.Add(consoleOut, 0, 0);
            tlp.Controls.Add(consoleIn, 0, 1);

            // i have no idea what this thing does
            // tlp.ResumeLayout(false);
            // tlp.PerformLayout();

            // create main form
            mainForm = new Form();
            mainForm.Size = new System.Drawing.Size(600, 400);

            mainForm.SuspendLayout();

            // add layout to the main form
            mainForm.Controls.Add(tlp);

            mainForm.ResumeLayout(false);
            mainForm.PerformLayout();

            mainForm.Show();

            Application.Run(mainForm);
        }
开发者ID:sopnic,项目名称:larytet-master,代码行数:51,代码来源:Main.cs

示例13: createMenuBar

        // Overridden by DXWindow
        protected virtual void createMenuBar(Form parent)
        {
            menuBar = new MenuStrip();
            parent.SuspendLayout();

            parent.Controls.Add(menuBar);
            parent.MainMenuStrip = menuBar;
            parent.ResumeLayout(false);
            parent.PerformLayout();
        }
开发者ID:BackupTheBerlios,项目名称:opendx2,代码行数:11,代码来源:MainWindow.cs

示例14: AutoSizeTest

		public void AutoSizeTest ()
		{
			ControlAutoSizeTester c = new ControlAutoSizeTester (new Size (23, 17), AutoSizeMode.GrowAndShrink);
			
			Form f = new Form();
			f.Size = new Size (200, 200);
			c.Parent = f;
			f.Show();
			
			Size s = new Size (42, 42);
			c.Size = s;
			
			Point l = new Point (10, 10);
			c.Location = l;
			
			//Check wether normal size setting is OK
			Assert.AreEqual (s, c.Size, "#S1");
			
			//Check wether size remains without GetPreferredSize implemented even when AutoSize turned on.
			c.AutoSize = true;
			f.PerformLayout();
			Assert.AreEqual (s, c.Size, "#S2");
			
			//Simulate a Control implementing GetPreferredSize
			c.UseCustomPrefSize = true;
			f.PerformLayout();
			
			//Check wether size shrinks to preferred size
			Assert.AreEqual (c.CustomPrefSize, c.Size, "#S3");
			//Check wether Location stays constant
			Assert.AreEqual (l, c.Location, "#L1");
			
			//Check wether Dock is respected
			c.Dock = DockStyle.Bottom;
			Assert.AreEqual (f.ClientSize.Width, c.Width, "#D1");
			
			//Check wether size shrinks to preferred size again
			c.Dock = DockStyle.None;
			Assert.AreEqual (c.CustomPrefSize, c.Size, "#S4");
			
			//Check wether Anchor is respected for adjusting Locatioon
			c.Anchor = AnchorStyles.Bottom;
			f.Height += 50;
			Assert.AreEqual (l.Y + 50, c.Top, "#A1");
			//Check wether size is still OK
			Assert.AreEqual (c.CustomPrefSize, c.Size, "#S5");
			
			
			//just tidy up
			c.Anchor = AnchorStyles.Top | AnchorStyles.Left;
			c.Location = l;
			
			//Check wether shrinking to zero is possible 
			c.CustomPrefSize = new Size (0, 0);
			f.PerformLayout();
			Assert.AreEqual (c.CustomPrefSize, c.Size, "#S6");
			
			//Check wether MinimumSize is honored
			c.MinimumSize = new Size (10, 12);
			c.CustomPrefSize = new Size (5, 5);
			f.PerformLayout();
			Assert.AreEqual (c.MinimumSize, c.Size, "#S7");
			c.MinimumSize = new Size (0, 0);
			
			//Check wether MaximumSize is honored
			c.MaximumSize = new Size (100, 120); 
			c.CustomPrefSize = new Size (500, 500);
			f.PerformLayout();
			Assert.AreEqual (c.MaximumSize, c.Size, "#S8");
			
			//Check wether shrinking does not happen when GrowOnly
			c.AutoSize = false;
			s = new Size (23, 23);
			c.Size = s;
			c.CustomPrefSize = new Size (5, 5);
			c.AutoSizeMode = AutoSizeMode.GrowOnly;
			c.AutoSize = true;
			f.PerformLayout();
			Assert.AreEqual (s, c.Size, "#S9");
			f.Close ();
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:81,代码来源:ControlTest.cs

示例15: CategoryEdit

 public void CategoryEdit(int chosen_category)
 {
     #region edit_category_form
     formEditCategory = new Form();
     formEditCategory.Name = "FormEditCategory";
     formEditCategory.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
     formEditCategory.Text = "Редагувати категорію";
     formEditCategory.TopMost = true;
     formEditCategory.ResumeLayout(false);
     formEditCategory.PerformLayout();
     formEditCategory.AutoScaleDimensions = new SizeF(6F, 13F);
     formEditCategory.AutoScaleMode = AutoScaleMode.Font;
     formEditCategory.ClientSize = new Size(384, 284);
     
     textBoxEditCategName = new TextBox();
     textBoxCategPK = new TextBox();
     richTextBoxEditCategInfo = new RichTextBox();
     Label label1 = new Label();
     Label label2 = new Label();
     Label label3 = new Label();            
     Button buttonAcceptEdit = new Button();
     Button buttonCancelEdit = new Button();
     // 
     // textBoxEditCategName
     // 
     textBoxEditCategName.Font = new System.Drawing.Font("Times New Roman", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
     textBoxEditCategName.Location = new System.Drawing.Point(165, 52);
     textBoxEditCategName.Name = "textBoxEditCategName";
     textBoxEditCategName.Size = new System.Drawing.Size(206, 26);
     textBoxEditCategName.TabIndex = 0;
     // 
     // richTextBoxEditCategInfo
     // 
     richTextBoxEditCategInfo.Location = new System.Drawing.Point(165, 93);
     richTextBoxEditCategInfo.Name = "richTextBoxEditCategInfo";
     richTextBoxEditCategInfo.Size = new System.Drawing.Size(206, 112);
     richTextBoxEditCategInfo.TabIndex = 1;
     richTextBoxEditCategInfo.Text = "";
     // 
     // label1
     // 
     label1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
     label1.Font = new System.Drawing.Font("Times New Roman", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
     label1.Location = new System.Drawing.Point(12, 52);
     label1.Name = "label1";
     label1.Size = new System.Drawing.Size(135, 29);
     label1.TabIndex = 2;
     label1.Text = "Назва категорії:";
     label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
     // 
     // label2
     // 
     label2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
     label2.Font = new System.Drawing.Font("Times New Roman", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
     label2.Location = new System.Drawing.Point(12, 93);
     label2.Name = "label2";
     label2.Size = new System.Drawing.Size(135, 55);
     label2.TabIndex = 3;
     label2.Text = "Інформація про категорію:";
     label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
     // 
     // label3
     // 
     label3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
     label3.Font = new System.Drawing.Font("Times New Roman", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
     label3.Location = new System.Drawing.Point(12, 9);
     label3.Name = "label3";
     label3.Size = new System.Drawing.Size(135, 29);
     label3.TabIndex = 4;
     label3.Text = "Номер категорії:";
     label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
     // 
     // textBoxCategPK
     // 
     textBoxCategPK.Font = new System.Drawing.Font("Times New Roman", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
     textBoxCategPK.Location = new System.Drawing.Point(166, 9);
     textBoxCategPK.Name = "textBoxCategPK";
     textBoxCategPK.ReadOnly = true;
     textBoxCategPK.Size = new System.Drawing.Size(206, 26);
     textBoxCategPK.TabIndex = 5;
     // 
     // buttonAcceptEdit
     // 
     buttonAcceptEdit.Font = new System.Drawing.Font("Times New Roman", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
     buttonAcceptEdit.Location = new System.Drawing.Point(44, 229);
     buttonAcceptEdit.Name = "buttonAcceptEdit";
     buttonAcceptEdit.Size = new System.Drawing.Size(145, 43);
     buttonAcceptEdit.TabIndex = 6;
     buttonAcceptEdit.Text = "Затвердити зміни та закрити вікно";
     buttonAcceptEdit.UseVisualStyleBackColor = true;
     buttonAcceptEdit.Click += new System.EventHandler(buttonAcceptEdit_Click);
     // 
     // buttonCancelEdit
     // 
     buttonCancelEdit.Font = new System.Drawing.Font("Times New Roman", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
     buttonCancelEdit.Location = new System.Drawing.Point(195, 229);
     buttonCancelEdit.Name = "buttonCancelEdit";
     buttonCancelEdit.Size = new System.Drawing.Size(144, 43);
     buttonCancelEdit.TabIndex = 7;
     buttonCancelEdit.Text = "Відмінити та закрити вікно";
//.........这里部分代码省略.........
开发者ID:segatank,项目名称:ado.net,代码行数:101,代码来源:CategoryOperations.cs


注:本文中的System.Windows.Forms.Form.PerformLayout方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。