當前位置: 首頁>>代碼示例>>C#>>正文


C# Form.Show方法代碼示例

本文整理匯總了C#中System.Windows.Forms.Form.Show方法的典型用法代碼示例。如果您正苦於以下問題:C# Form.Show方法的具體用法?C# Form.Show怎麽用?C# Form.Show使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Windows.Forms.Form的用法示例。


在下文中一共展示了Form.Show方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: OnKeyDown

 protected override void OnKeyDown(KeyEventArgs e)
 {
     base.OnKeyDown(e);
     switch (e.KeyCode)
     {
         case Keys.D:
             if (form == null)
             {
                 form = new Form();
                 form.Text = "Undocked Control";
                 form.Width = Width;
                 form.Height = Height;
                 form.FormBorderStyle = FormBorderStyle.SizableToolWindow;
                 this.Controls.Remove(control);
                 form.Controls.Add(control);
                 form.FormClosed += delegate (object sender,FormClosedEventArgs ee)
                 {
                     form.Controls.Remove(control);
                     this.Controls.Add(control);
                     form = null;
                 };
                 form.Show();
             }
             else
             {
                 form.Close();
             }
             break;
     }
 }
開發者ID:CryZENx,項目名稱:CrashEdit,代碼行數:30,代碼來源:UndockableControl.cs

示例2: Activated

		public void Activated ()
		{
			if (TestHelper.RunningOnUnix)
				Assert.Ignore ("#3 fails");

			_form = new Form ();
			EventLogger logger = new EventLogger (_form);
			_form.ShowInTaskbar = false;
			Assert.AreEqual (0, logger.CountEvents ("Activated"), "#1");
			_form.Activate ();
			Application.DoEvents ();
			Assert.AreEqual (0, logger.CountEvents ("Activated"), "#2");
			_form.Show ();
			Application.DoEvents ();
			Assert.AreEqual (1, logger.CountEvents ("Activated"), "#3");
			_form.Show ();
			Application.DoEvents ();
			Assert.AreEqual (1, logger.CountEvents ("Activated"), "#4");
			_form.Activate ();
			Application.DoEvents ();
			Assert.AreEqual (1, logger.CountEvents ("Activated"), "#5");
			_form.Hide ();
			Application.DoEvents ();
			Assert.AreEqual (1, logger.CountEvents ("Activated"), "#6");
			_form.Show ();
			Application.DoEvents ();
			Assert.AreEqual (2, logger.CountEvents ("Activated"), "#7");
		}
開發者ID:GirlD,項目名稱:mono,代碼行數:28,代碼來源:FormEventTest.cs

示例3: ShowForm

 public static void ShowForm(Form form, bool show)
 {
     if (form.InvokeRequired)
     {
         form.BeginInvoke(new Action(() =>
         {
             if (show)
             {
                 form.Show();
                 form.BringToFront();
                 form.WindowState = FormWindowState.Normal;
             }
             else
             {
                 form.Hide();
                 form.WindowState = FormWindowState.Minimized;
             }
         }));
     }
     else
     {
         if (show)
         {
             form.Show();
             form.BringToFront();
             form.WindowState = FormWindowState.Normal;
         }
         else
         {
             form.Hide();
             form.WindowState = FormWindowState.Minimized;
         }
     }
 }
開發者ID:peterwillcn,項目名稱:Avalon-nano,代碼行數:34,代碼來源:SafeControlUpdater.cs

示例4: ShowImage

 public static void ShowImage(Bitmap bitmap)
 {
     var form = new Form { ClientSize = bitmap.Size };
      var pb = new PictureBox { Image = bitmap, SizeMode = PictureBoxSizeMode.AutoSize };
      form.Controls.Add(pb);
      form.Show();
 }
開發者ID:ItzWarty,項目名稱:the-dargon-project,代碼行數:7,代碼來源:DebuggingUtilities.cs

示例5: ActiveControlForm

        public ActiveControlForm()
        {
            InitializeComponent();
            this.IsMdiContainer = true;
            var form1 = new Form
            {
                Text = "form1",
                MdiParent = this,
            };

            var form2 = new Form
            {
                Text = "form2",
                MdiParent = this,
                Controls = {
                    new TextBox {
                        Text = "Textie",
                        Name = "textbox1",
                    },
                }
            };

            listBox1.Items.AddRange(new object[] 
            {
                "Hello",
                "World",
            });
            form1.Show();
            form2.Show();
        }
開發者ID:gitter-badger,項目名稱:reko,代碼行數:30,代碼來源:ActiveControlForm.cs

示例6: onLoginLoad

		private void onLoginLoad(object sender, EventArgs e)
		{
			this.CenterToScreen();
			this.Location = new Point(this.Location.X, this.Location.Y / 2);

			updateViews();

			//if (Program.settings.popupForVersion < 1) {
			//	MessageBox.Show("The Check-In program has been updated,\nplease verify the following settings:\n\n" +
			//		"Login Page\n\n- Server name (e.g. <yourchurch>.tpsdb.com)\n- Username\n- Password\n- Printer\n- Advanced Page Size (Optional)\n\n" +
			//		"Settings Page\n\n- Campus\n- Early Checkin Hours\n- Late Checkin Minutes\n- Checkboxes at the bottom", "New Version", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

			//	Program.settings.setPopupForVersion(1);
			//}

			keyboard = new CommonKeyboard(this);
			keyboard.Show();
			attachKeyboard();

			URL.Text = Program.settings.subdomain;
			username.Text = Program.settings.user;

			if (username.Text.Length > 0) {
				current = password;
				this.ActiveControl = password;
			} else {
				current = URL;
				this.ActiveControl = URL;
			}
		}
開發者ID:stevesloka,項目名稱:bvcms,代碼行數:30,代碼來源:Login.cs

示例7: ActiveFormNegativeTest2

        public void ActiveFormNegativeTest2()
        {
            RichTextBoxTarget target = new RichTextBoxTarget()
            {
                FormName = "MyForm1",
                UseDefaultRowColoringRules = true,
                Layout = "${level} ${logger} ${message}",
            };

            using (Form form = new Form())
            {
                form.Name = "MyForm1";
                form.WindowState = FormWindowState.Minimized;
                form.Show();

                try
                {
                    target.Initialize(CommonCfg);
                    Assert.Fail("Expected exception.");
                }
                catch (NLogConfigurationException ex)
                {
                    Assert.IsNotNull(ex.InnerException);
                    Assert.AreEqual("Rich text box control name must be specified for RichTextBoxTarget.", ex.InnerException.Message);
                }
            }
        }
開發者ID:ExM,項目名稱:NLog,代碼行數:27,代碼來源:RichTextBoxTargetTests.cs

示例8: ShowNewForm

 private void ShowNewForm(object sender, EventArgs e)
 {
     Form childForm = new Form();
     childForm.MdiParent = this;
     childForm.Text = "Window " + childFormNumber++;
     childForm.Show();
 }
開發者ID:ViniciusConsultor,項目名稱:elias,代碼行數:7,代碼來源:MDIPrincipal.cs

示例9: vCargaForma

        public static void vCargaForma(Form Formulario, Form FormularioPadre, string strText)
        {

            Formulario.Text = strText;

            foreach (Form ctr in FormularioPadre.MdiChildren)
            {
                if (ctr.Text == Formulario.Text)
                {
                    ctr.Focus();
                    Formulario.Dispose();
                    return;
                }

            }            

            Formulario.WindowState = FormWindowState.Maximized;
            Formulario.MdiParent = FormularioPadre;
            Formulario.ControlBox = false;

            Formulario.BackgroundImage = ConsultasIkorMysql.Properties.Resources.fondo;
            Formulario.Icon = ConsultasIkorMysql.Properties.Resources.ToolboxWindow;
            Formulario.BackgroundImageLayout = ImageLayout.Stretch;
            Formulario.Show();
            Formulario.WindowState = FormWindowState.Maximized;
            
        }
開發者ID:primedevmx,項目名稱:3.-ConsultasIkorMysql,代碼行數:27,代碼來源:clSeguridad.cs

示例10: AutoSize

		public void AutoSize ()
		{
			if (TestHelper.RunningOnUnix)
				Assert.Ignore ("Dependent on font height and theme, values are for windows.");
				
			Form f = new Form ();
			f.ShowInTaskbar = false;

			GroupBox p = new GroupBox ();
			p.AutoSize = true;
			f.Controls.Add (p);

			Button b = new Button ();
			b.Size = new Size (200, 200);
			b.Location = new Point (200, 200);
			p.Controls.Add (b);

			f.Show ();

			Assert.AreEqual (new Size (406, 419), p.ClientSize, "A1");

			p.Controls.Remove (b);
			Assert.AreEqual (new Size (200, 100), p.ClientSize, "A2");

			p.AutoSizeMode = AutoSizeMode.GrowAndShrink;
			Assert.AreEqual (new Size (6, 19), p.ClientSize, "A3");

			f.Dispose ();
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:29,代碼來源:GroupBoxTest.cs

示例11: ToolTip

        // TODO: organise Tips.cs
        /// <summary>
        /// Creates an always-on-top window anywhere on the screen.
        /// </summary>
        /// <param name="Text">
        /// <para>If blank or omitted, the existing tooltip (if any) will be hidden. Otherwise, this parameter is the text to display in the tooltip. To create a multi-line tooltip, use the linefeed character (`n) in between each line, e.g. Line1`nLine2.</para>
        /// <para>If Text is long, it can be broken up into several shorter lines by means of a continuation section, which might improve readability and maintainability.</para>
        /// </param>
        /// <param name="X">The X position of the tooltip relative to the active window (use "CoordMode, ToolTip" to change to screen coordinates). If the coordinates are omitted, the tooltip will be shown near the mouse cursor. X and Y can be expressions.</param>
        /// <param name="Y">The Y position (see <paramref name="X"/>).</param>
        /// <param name="ID">Omit this parameter if you don't need multiple tooltips to appear simultaneously. Otherwise, this is a number between 1 and 20 to indicate which tooltip window to operate upon. If unspecified, that number is 1 (the first).</param>
        public static void ToolTip(string Text, int X, int Y, int ID)
        {
            if (tooltip == null)
            {
                tooltip = new Form
                {
                    Width = 0,
                    Height = 0,
                    Visible = false
                };
                tooltip.Show();
            }

            if (persistentTooltip == null)
                persistentTooltip = new ToolTip
                {
                    AutomaticDelay = 0,
                    InitialDelay = 0,
                    ReshowDelay = 0,
                    ShowAlways = true
                };

            var bounds = Screen.PrimaryScreen.WorkingArea;
            persistentTooltip.Show(Text, tooltip, new Point((bounds.Left - bounds.Right) / 2, (bounds.Bottom - bounds.Top) / 2));
        }
開發者ID:Tyelpion,項目名稱:IronAHK,代碼行數:36,代碼來源:Tips.cs

示例12: Indexer_ColumnName

		public void Indexer_ColumnName ()
		{
			Form form = new Form ();
			form.ShowInTaskbar = false;
			form.Controls.Add (_dataGridView);
			form.Show ();

			DataGridViewCellCollection cells = _dataGridView.Rows [0].Cells;

			DataGridViewCell dateCell = cells ["Date"];
			Assert.IsNotNull (dateCell, "#A1");
			Assert.IsNotNull (dateCell.OwningColumn, "#A2");
			Assert.AreEqual ("Date", dateCell.OwningColumn.Name, "#A3");
			Assert.IsNotNull (dateCell.Value, "#A4");
			Assert.AreEqual (new DateTime (2007, 2, 3), dateCell.Value, "#A5");

			DataGridViewCell eventCell = cells ["eVeNT"];
			Assert.IsNotNull (eventCell, "#B1");
			Assert.IsNotNull (eventCell.OwningColumn, "#B2");
			Assert.AreEqual ("Event", eventCell.OwningColumn.Name, "#B3");
			Assert.IsNotNull (eventCell.Value, "#B4");
			Assert.AreEqual ("one", eventCell.Value, "#B5");

			DataGridViewCell registeredCell = cells ["Registered"];
			Assert.IsNotNull (registeredCell, "#C1");
			Assert.IsNotNull (registeredCell.OwningColumn, "#C2");
			Assert.AreEqual ("Registered", registeredCell.OwningColumn.Name, "#C3");
			Assert.IsNotNull (registeredCell.Value, "#C4");
			Assert.AreEqual (false, registeredCell.Value, "#C5");

			form.Dispose ();
		}
開發者ID:Profit0004,項目名稱:mono,代碼行數:32,代碼來源:DataGridViewCellCollectionTest.cs

示例13: MenuItemClickHandler

        private void MenuItemClickHandler(object sender, EventArgs e)
        {
            try
            {
                ToolStripMenuItem clickedItem = (ToolStripMenuItem)sender;

                string selectClickedForm = string.Format("SELECT [menu_id] ,[parent_menu_id],[menu_name],[form_name],[menu_level] FROM [IMS].[dbo].[menu] where menu_id='{0}'", clickedItem.Name);
                DataSet ds = dbadmin.ReturnDataSet(selectClickedForm);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    CloseAllRunForm();
                    Type type = Type.GetType("WindowsFormsApplication1." + ds.Tables[0].Rows[0][3].ToString());
                    frmObj = Activator.CreateInstance(type) as Form;
                    frmObj.MdiParent = this;

                    //frmObj1 = Activator.CreateInstance(type) as object;
                    //InsertComand = type.GetMethod("InsertComand");
                    //EditComand = type.GetMethod("EditComand");
                    //DeleteComand = type.GetMethod("DeleteComand");
                    //resize = type.GetMethod("resizeGroupBox");

                    frmObj.Show();

                }
            }
            catch (Exception)
            {

                MessageBox.Show("Form not found. ");
            }
        }
開發者ID:monzurmorshed,項目名稱:POS,代碼行數:31,代碼來源:MainForm.cs

示例14: DefaultPosition

 private void DefaultPosition(Form form)
 {
     form.Left = 0;
     form.Top = 0;
     form.StartPosition = FormStartPosition.Manual;
     form.Show();
 }
開發者ID:oleguchok,項目名稱:SPP-Labs,代碼行數:7,代碼來源:ExtensibleGUI.cs

示例15: AutoSize

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

			Panel p = new Panel ();
			p.AutoSize = true;
			f.Controls.Add (p);
			
			Button b = new Button ();
			b.Size = new Size (200, 200);
			b.Location = new Point (200, 200);
			p.Controls.Add (b);

			f.Show ();

			Assert.AreEqual (new Size (403, 403), p.ClientSize, "A1");
			
			p.Controls.Remove (b);
			Assert.AreEqual (new Size (200, 100), p.ClientSize, "A2");
			
			p.AutoSizeMode = AutoSizeMode.GrowAndShrink;
			Assert.AreEqual (new Size (0, 0), p.ClientSize, "A3");
			f.Dispose ();
		}
開發者ID:KonajuGames,項目名稱:SharpLang,代碼行數:25,代碼來源:PanelTest.cs


注:本文中的System.Windows.Forms.Form.Show方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。