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


C# Form.Activate方法代码示例

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


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

示例1: 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

示例2: mostrarNuevaVentana

 public static void mostrarNuevaVentana(Form ventanaNueva, Form ventanaPadre)
 {
     ventanaNueva.Visible = true;
     ventanaNueva.Activate();
     ventanaNueva.Select();
     ventanaPadre.Hide();
 }
开发者ID:julianSelser,项目名称:clinica,代码行数:7,代码来源:AsistenteVistas.cs

示例3: InstanceFormChild

        public static void InstanceFormChild(Form frmChild, Form frmParent, bool modal)
        {
            if (frmParent != null)
                foreach (var item in frmParent.MdiChildren)
                {
                    if (item.GetType() == frmChild.GetType())
                    {
                        frmChild.Focus();
                        frmChild.BringToFront();
                        frmChild.Activate();
                        return;
                    }
                }

            frmChild.ShowInTaskbar = false;

            if (modal)
            {
                frmChild.TopLevel = true;
                frmChild.ShowDialog();
            }
            else
            {
                if (frmParent != null)
                    frmChild.MdiParent = frmParent;

                frmChild.Show();
            }
        }
开发者ID:tonfranco,项目名称:LR,代码行数:29,代码来源:FormUtil.cs

示例4: bringToFront

        // [focus]
        /// <summary>
        /// bring form to foreground </summary>
        public static void bringToFront(Form form)
        {
            Program.log.write("bringToFront");
            Tick.timer(500, (t, args) =>
            {
                if (t is Timer)
                {
                    Timer timer = t as Timer;

                    Program.log.write("bringToFront: tick");
                    timer.Enabled = false;

                    //diagram bring to top hack in windows
                    if (form.WindowState == FormWindowState.Minimized)
                    {
                        form.WindowState = FormWindowState.Normal;
                    }

            #if !MONO
                    SetForegroundWindow(form.Handle.ToInt32());
            #endif
                    form.TopMost = true;
                    form.Focus();
                    form.BringToFront();
                    form.TopMost = false;
                    form.Activate();
                }
            });
        }
开发者ID:pekand,项目名称:infinite-diagram,代码行数:32,代码来源:Media.cs

示例5: volverAPadreYCerrar

 public static void volverAPadreYCerrar(Form ventanaPadre, Form ventana)
 {
     ventanaPadre.Visible = true;
     ventanaPadre.Activate();
     ventanaPadre.Select();
     ventana.Close();
 }
开发者ID:julianSelser,项目名称:clinica,代码行数:7,代码来源:AsistenteVistas.cs

示例6: Activate

 /// <summary>
 /// Activate 一个 Form。包括了处理最小化时候恢复显示的功能
 /// </summary>
 /// <param name="form">Form</param>
 public static void Activate(Form form)
 {
     if (form != null)
     {
         if (form.WindowState == FormWindowState.Minimized)
             form.WindowState = FormWindowState.Normal;
         form.Activate();
     }
 }
开发者ID:paopaofeng,项目名称:dp2,代码行数:13,代码来源:Global.cs

示例7: CallCoreWorkbench

        /// <summary>
        /// 调入EasternArt主窗体进行显示.
        /// </summary>
        public static void CallCoreWorkbench(Form window)
        {
            _startupWindow = window;

            CoreWorkbench bench = new CoreWorkbench();
            bench.Closing += new CancelEventHandler(StartupWindowClosing);
            bench.Show();
            window.Activate();
            _logger.Info(LogString.Normal(StringService.CoreWorkbenchGettingOpened));
        }
开发者ID:ViniciusConsultor,项目名称:geansoft,代码行数:13,代码来源:CallHelper.cs

示例8: StartSplashScreen

 public static void StartSplashScreen(Form mainForm, SplashScreenOptions options)
 {
     callingForm = mainForm;
     formTitle = callingForm.Text;
     callingForm.Hide();
     Thread splashthread = new Thread(new ParameterizedThreadStart(SplashScreen.ShowSplashScreen));
     splashthread.IsBackground = true;
     splashthread.Start(options);
     Thread.Sleep(100);
     callingForm.Activate();
 }
开发者ID:adrianj,项目名称:AdriansLib,代码行数:11,代码来源:SplashScreen.cs

示例9: ShowWindow

 /// <summary>
 /// Shows the window.
 /// </summary>
 /// <param name="form">The form.</param>
 private static void ShowWindow(Form form)
 {
     if (form.Visible)
     {
         form.Activate();
         if (form.WindowState == FormWindowState.Minimized)
             form.WindowState = FormWindowState.Normal;
     }
     else
     {
         form.Show();
     }
 }
开发者ID:gayancc,项目名称:eveminer-code,代码行数:17,代码来源:MainForm.cs

示例10: ActivateParentForm

        private static void ActivateParentForm(Form parentForm)
        {
            if (parentForm != null)
            {
                //HandleRef href = new HandleRef(ParentForm, ParentForm.Handle);
                //SetForegroundWindow(href);

                parentForm.Invoke(new Action(() => { parentForm.Activate(); }));
            }
            else if (ApplicationService.Current.MainForm != null)
            {
                ApplicationService.Current.MainForm.Invoke(new Action(() => { ApplicationService.Current.MainForm.Activate(); }));
            }
        }
开发者ID:JodenSoft,项目名称:JodenSoft,代码行数:14,代码来源:ProgressService.cs

示例11: ActivateForm

        public override void ActivateForm(Form form, DesktopWindow window, IntPtr hwnd)
        {
            if (window == null || window.Handle != form.Handle)
            {
                Log.InfoFormat("[{0}] Activating Main Window - current=({1})", hwnd, window != null ? window.Exe : "?");

                form.BringToFront();
                form.Focus();
                form.Show();
                form.Activate();

                // stop flashing...happens occassionally when switching quickly when activate manuver is fails
                NativeMethods.FlashWindow(form.Handle, NativeMethods.FLASHW_STOP);
            }
        }
开发者ID:mesenger,项目名称:superputty,代码行数:15,代码来源:WindowActivator.cs

示例12: Activated_Dialog

		public void Activated_Dialog ()
		{
			if (TestHelper.RunningOnUnix)
				Assert.Ignore ("#4 fails");

			_form = new DelayedCloseForm ();
			EventLogger logger = new EventLogger (_form);
			_form.ShowInTaskbar = false;
			Assert.AreEqual (0, logger.CountEvents ("Activated"), "#1");
			_form.Activate ();
			Assert.AreEqual (0, logger.CountEvents ("Activated"), "#2");
			_form.ShowDialog ();
			Assert.AreEqual (1, logger.CountEvents ("Activated"), "#3");
			_form.ShowDialog ();
			Assert.AreEqual (2, logger.CountEvents ("Activated"), "#4");
		}
开发者ID:GirlD,项目名称:mono,代码行数:16,代码来源:FormEventTest.cs

示例13: TRACE

        public static void TRACE(Form owner, string message)
        {
            if (TraceFrm.m_instance == null)
            {
                TraceFrm.m_instance = new TraceFrm();

                if(owner != null)
                {
                    TraceFrm.m_instance.Location = new Point(owner.Right + (SystemInformation.BorderSize.Width * 2), owner.Top);
                    owner.Activate();
                }
                TraceFrm.m_instance.Show();
            }

            TraceFrm.m_instance.Write(message);
        }
开发者ID:soeminnminn,项目名称:BattleCity,代码行数:16,代码来源:TraceFrm.cs

示例14: btnGo_Click

        private void btnGo_Click(object sender, EventArgs e)
        {
            switch (Convert.ToInt32(numProject.Value))
            {
                case 0:
                    problem = new Problem_Forms.Problem0();
                    break;
                case 1:
                    problem = new Problem_Forms.Problem1();
                    break;
                case 3:
                    problem = new Problem_Forms.Problem3();
                    break;
                case 51:
                    problem = new Problem_Forms.Problem51();
                    break;
                case 54:
                    problem = new Problem_Forms.Problem54();
                    break;
                case 70:
                    problem = new Problem_Forms.Problem70();
                    break;
                case 71:
                    problem = new Problem_Forms.Problem71();
                    break;
                case 72:
                    problem = new Problem_Forms.Problem72();
                    break;
                case 451:
                    problem = new Problem_Forms.Problem451();
                    break;
                default:
                    problem = null;
                    break;
            }

            try
            {
                problem.Show();
                problem.Activate();
            }
            catch (NullReferenceException)
            {
                MessageBox.Show("Solution not programmed for this problem.", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
开发者ID:Scott-Caldwell,项目名称:ProjectEuler,代码行数:46,代码来源:MainForm.cs

示例15: CargarFormulario

 private void CargarFormulario(object sender, EventArgs e)
 {
     Form Cargar = new Form();
     if (sender is ToolStripButton)
     {
         var vBoton = (ToolStripButton)sender;
         if (vBoton.Tag != null) { Cargar = (Form)vBoton.Tag; }
     }
     else
     {
         if (sender is ToolStripMenuItem)
         {
             var vMenuItem = (ToolStripMenuItem)sender;
             if (vMenuItem.Tag != null) { Cargar = (Form)vMenuItem.Tag; }
         }
         else
         {
             if (sender is ToolStripDropDownButton)
             {
                 var vBotonDesp = (ToolStripDropDownButton)sender;
                 if (vBotonDesp.Tag != null) { Cargar = (Form)vBotonDesp.Tag; }
             }
         }
     }
     try
     {
         if (fFormAnterior != null) { fFormAnterior.Hide(); }
             Assembly asm = Assembly.GetEntryAssembly();
             fFormularioPrincipal = new Form();
             fFormularioPrincipal = Cargar;
             fFormularioPrincipal.Activate();
             fFormularioPrincipal.FormBorderStyle = FormBorderStyle.None;
             fFormularioPrincipal.Dock = DockStyle.Fill;
             fFormularioPrincipal.Size = new System.Drawing.Size(this.Width,this.Height);
             fFormularioPrincipal.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
             fFormularioPrincipal.MdiParent = wfAdminitrador.ActiveForm;
             fFormularioPrincipal.Show();
             fFormAnterior = fFormularioPrincipal;          
     }
     catch (Exception ex) { MessageBox.Show(ex.ToString()); }
 }
开发者ID:EbricenterOrg,项目名称:Seguridad,代码行数:41,代码来源:wfAdminitrador.cs


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