當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。