本文整理汇总了C#中System.Windows.Forms.Form.BringToFront方法的典型用法代码示例。如果您正苦于以下问题:C# Form.BringToFront方法的具体用法?C# Form.BringToFront怎么用?C# Form.BringToFront使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Form
的用法示例。
在下文中一共展示了Form.BringToFront方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
}
}
示例2: Show
/// <summary>
/// Draws a MessageBox that always stays on top with a title, selectable buttons and an icon
/// </summary>
static public DialogResult Show(string message, string title,
MessageBoxButtons buttons,MessageBoxIcon icon)
{
// Create a host form that is a TopMost window which will be the
// parent of the MessageBox.
Form topmostForm = new Form();
// We do not want anyone to see this window so position it off the
// visible screen and make it as small as possible
topmostForm.Size = new System.Drawing.Size(1, 1);
topmostForm.StartPosition = FormStartPosition.Manual;
System.Drawing.Rectangle rect = SystemInformation.VirtualScreen;
topmostForm.Location = new System.Drawing.Point(rect.Bottom + 10,
rect.Right + 10);
topmostForm.Show();
// Make this form the active form and make it TopMost
topmostForm.Focus();
topmostForm.BringToFront();
topmostForm.TopMost = true;
// Finally show the MessageBox with the form just created as its owner
DialogResult result = MessageBox.Show(topmostForm, message, title,
buttons,icon);
topmostForm.Dispose(); // clean it up all the way
return result;
}
示例3: Scan
public Scan(Program.Options options)
{
log.Debug("creating scan host");
log.DebugFormat("create interprocess input pipe (handle={0})", options.pipeIn);
pipeIn = new AnonymousPipeClientStream(PipeDirection.In, options.pipeIn);
log.DebugFormat("create interprocess output pipe (handle={0})", options.pipeOut);
pipeOut = new AnonymousPipeClientStream(PipeDirection.Out, options.pipeOut);
log.Debug("create sync event");
sync = new ManualResetEvent(false);
log.Debug("create native messaging port");
port = new Port(pipeIn, pipeOut);
log.Debug("create stop event");
stop = new ManualResetEvent(false);
log.Debug("create form");
form = new Form();
form.TopMost = true;
form.BringToFront();
log.Debug("create hook");
hook = new WinFormsWindowMessageHook(form);
log.Debug("create image acquired and image transferred events");
imageAcquired = new ManualResetEvent(false);
imageTransferred = new ManualResetEvent(false);
log.Debug("scan host created");
}
示例4: set_window
public void set_window(Form frm)
{
foreach (Control control in panel_container.Controls)
{
if (control.Text == frm.Text)
{
control.BringToFront();
current_form = (Form)frm;
frm.Dispose();
return;
}
}
frm.TopLevel = false;
frm.Dock = System.Windows.Forms.DockStyle.Fill;
frm.FormBorderStyle = FormBorderStyle.None;
frm.TopMost = true;
this.panel_container.Controls.Add(frm);
frm.Show();
frm.BringToFront();
current_form = (Form)frm;
TreeNode node = new TreeNode();
node.Text = frm.Text;
tree_menu.Nodes.Add(node);
}
示例5: 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();
}
}
示例6: 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();
}
});
}
示例7: SettForm
public void SettForm(Form frm)
{
frm.TopLevel = false;
frm.Visible = true;
panelMENU.Controls.Add(frm);
panelMENU.Controls[frm.Name].Focus();
frm.BringToFront();
}
示例8: BringToFront
public static void BringToFront(Form form)
{
// Make this form the active form
form.TopMost = true;
form.Focus();
form.BringToFront();
form.TopMost = false;
}
示例9: FormClosingCheck
public static DialogResult FormClosingCheck(Form frmName)
{
if (frmName.WindowState == System.Windows.Forms.FormWindowState.Minimized)
{
frmName.WindowState = FormWindowState.Normal;
}
frmName.BringToFront();
// Ask user what to do with the changes
return MessageBox.Show(CultureSupport.TextDictionary("MS_DATACHANGED", TextReturnTypeEnum.PureString), frmName.Text, MessageBoxButtons.YesNoCancel);
}
示例10: displayFormOnPanel
public static void displayFormOnPanel(Control.ControlCollection control, Form newForm)
{
bool isExist = control.Contains(newForm);
if (isExist == false)
{
newForm.TopLevel = false; //设置为非顶级窗体
newForm.FormBorderStyle = FormBorderStyle.None; //设置窗体为非边框样式
newForm.Dock = System.Windows.Forms.DockStyle.Fill; //设置样式是否填充整个PANEL
control.Add(newForm); //添加窗体
newForm.Show();
}
newForm.BringToFront();
}
示例11: FixFormFields
private static void FixFormFields(Form form, Label label, TextBox textBox, Button buttonOk, Button buttonCancel)
{
form.ClientSize = new Size(396, 107);
form.Controls.AddRange(new Control[] {label, textBox, buttonOk, buttonCancel});
form.ClientSize = new Size(Math.Max(300, label.Right + 10), form.ClientSize.Height);
form.FormBorderStyle = FormBorderStyle.FixedDialog;
form.StartPosition = FormStartPosition.CenterScreen;
form.MinimizeBox = false;
form.MaximizeBox = false;
form.AcceptButton = buttonOk;
form.CancelButton = buttonCancel;
form.BringToFront();
}
示例12: 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);
}
}
示例13: Show
public static DialogResult Show(string message, string title, MessageBoxButtons buttons)
{
Form topmostForm = new Form();
topmostForm.Size = new System.Drawing.Size(1, 1);
topmostForm.StartPosition = FormStartPosition.Manual;
System.Drawing.Rectangle rect = SystemInformation.VirtualScreen;
topmostForm.Location = new System.Drawing.Point(rect.Bottom + 10, rect.Right + 10);
topmostForm.Show();
topmostForm.Focus();
topmostForm.BringToFront();
topmostForm.TopMost = true;
DialogResult result = MessageBox.Show(topmostForm, message, title, buttons);
topmostForm.Dispose();
return result;
}
示例14: AbrirEnContainerNewForm
public static void AbrirEnContainerNewForm(Form frmNueva,Panel pnlContenedor)
{
Herramientas.frmContAnterior = Herramientas.frmContActual;
Herramientas.frmContActual = frmNueva;
if (frmContAnterior != null)
{
frmContAnterior.Close();
frmContAnterior.Dispose();
}
frmContActual.TopLevel = false;
pnlContenedor.Controls.Add(frmContActual);
frmContActual.Show();
frmContActual.BringToFront();
}
示例15: smethod_1
// Token: 0x06002EFA RID: 12026
// RVA: 0x00130E14 File Offset: 0x0012F014
public static DialogResult smethod_1(string string_0, string string_1, MessageBoxButtons messageBoxButtons_0, MessageBoxIcon messageBoxIcon_0, MessageBoxDefaultButton messageBoxDefaultButton_0)
{
SplashScreen.smethod_3();
Form form = new Form();
form.ShowInTaskbar = false;
form.Size = new Size(1, 1);
form.StartPosition = FormStartPosition.Manual;
Rectangle virtualScreen = SystemInformation.VirtualScreen;
form.Location = new Point(virtualScreen.Bottom + 10, virtualScreen.Right + 10);
form.Show();
form.Focus();
form.BringToFront();
form.TopMost = true;
DialogResult result = MessageBox.Show(form, string_0, string_1, messageBoxButtons_0, messageBoxIcon_0);
form.Dispose();
return result;
}