当前位置: 首页>>代码示例>>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;未经允许,请勿转载。