本文整理汇总了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");
}
示例2: mostrarNuevaVentana
public static void mostrarNuevaVentana(Form ventanaNueva, Form ventanaPadre)
{
ventanaNueva.Visible = true;
ventanaNueva.Activate();
ventanaNueva.Select();
ventanaPadre.Hide();
}
示例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();
}
}
示例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();
}
});
}
示例5: volverAPadreYCerrar
public static void volverAPadreYCerrar(Form ventanaPadre, Form ventana)
{
ventanaPadre.Visible = true;
ventanaPadre.Activate();
ventanaPadre.Select();
ventana.Close();
}
示例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();
}
}
示例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));
}
示例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();
}
示例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();
}
}
示例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(); }));
}
}
示例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);
}
}
示例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");
}
示例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);
}
示例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);
}
}
示例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()); }
}