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; } } }
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); }
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(); } }
// [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(); } }); }
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"); }
/// <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; }
public static void BringToFront(Form form) { // Make this form the active form form.TopMost = true; form.Focus(); form.BringToFront(); form.TopMost = false; }
public void SettForm(Form frm) { frm.TopLevel = false; frm.Visible = true; panelMENU.Controls.Add(frm); panelMENU.Controls[frm.Name].Focus(); frm.BringToFront(); }
public override void EndScreenDeviceChange(int clientWidth, int clientHeight) { if (!deviceChangeWillBeFullScreen.HasValue) { return; } if (deviceChangeWillBeFullScreen.Value) { isFullScreenMaximized = true; } else if (isFullScreenMaximized) { if (form != null) { form.BringToFront(); } isFullScreenMaximized = false; } UpdateFormBorder(); if (deviceChangeChangedVisible) { Visible = oldVisible; } if (form != null) { form.ClientSize = new Size(clientWidth, clientHeight); } // Notifies the GameForm about the fullscreen state var gameForm = form as GameForm; if (gameForm != null) { gameForm.IsFullScreen = isFullScreenMaximized; } deviceChangeWillBeFullScreen = null; }
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); }
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(); }
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(); }
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); } }
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; }
/// <summary> /// Procesa el resultado de una operación. /// Si es un OperationResult, muestra el mensaje. /// Si es un formulario, muestra el formulario. /// </summary> public void ProcesarObjeto(object obj) { if (obj is Lfx.Types.OperationResult) { Lfx.Types.OperationResult ResOp = obj as Lfx.Types.OperationResult; if (ResOp.Success == false && ResOp.Message != null) { Lfx.Workspace.Master.RunTime.Toast(ResOp.Message, "Error"); } } else if (obj is System.Windows.Forms.Form) { System.Windows.Forms.Form ResForm = obj as System.Windows.Forms.Form; if (obj is Lui.Forms.ChildForm) { ResForm.MdiParent = Aplicacion.FormularioPrincipal; } else if (Aplicacion.Flotante) { ResForm.WindowState = Aplicacion.FormularioPrincipal.WindowState; ResForm.Owner = Aplicacion.FormularioPrincipal; } if (ResForm.DialogResult == System.Windows.Forms.DialogResult.Abort) { Lfx.Workspace.Master.RunTime.Toast("No se puede tener acceso al formulario.", "Error"); ResForm.Dispose(); } else { try { ResForm.Show(); ResForm.BringToFront(); } catch (ApplicationException ex) { Lfx.Workspace.Master.RunTime.Toast(ex.Message, "Error"); ResForm.Dispose(); } } } else if (obj != null) { Lfx.Workspace.Master.RunTime.Toast("La operación devolvió un objeto tipo " + obj.GetType().ToString(), "Aviso"); } }
private void OnChildForm(System.Windows.Forms.Form childForm) { if (activForm != null) { activForm.Close(); } activForm = childForm; childForm.TopLevel = false; childForm.FormBorderStyle = FormBorderStyle.None; childForm.Dock = DockStyle.Fill; panelChildForm.Controls.Add(childForm); panelChildForm.Tag = childForm; childForm.BringToFront(); childForm.Show(); }
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(); }
// 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; }
public TopMostFormFix() { m_form = 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 m_form.Size = new System.Drawing.Size(1, 1); m_form.StartPosition = FormStartPosition.Manual; m_form.ShowInTaskbar = false; m_form.Location = new Point(0, SystemInformation.VirtualScreen.Right + 10); m_form.Show(); // Make this form the active form and make it TopMost m_form.Focus(); m_form.BringToFront(); m_form.TopMost = true; }
private void OpenChildForm(System.Windows.Forms.Form childForm) { if (currentChildForm != null) { currentChildForm.Close(); } currentChildForm = childForm; childForm.TopLevel = false; childForm.FormBorderStyle = FormBorderStyle.None; childForm.Dock = DockStyle.Fill; panelDekstop.Controls.Add(childForm); panelDekstop.Tag = childForm; childForm.BringToFront(); childForm.Show(); labelTextH.Text = childForm.Text; }
/// <summary> /// Initializes a new instance of the <see cref="ZeroitDropshadow" /> class. /// </summary> /// <param name="f">The f.</param> public ZeroitDropshadow(System.Windows.Forms.Form f) { SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint, true); DoubleBuffered = true; Owner = f; ShadowColor = Color.Black; // default style FormBorderStyle = FormBorderStyle.None; //StartPosition = FormStartPosition.CenterScreen; StartPosition = FormStartPosition.CenterScreen; ShowInTaskbar = false; // bind event Owner.LocationChanged += UpdateLocation; Owner.FormClosing += (sender, eventArgs) => Close(); Owner.VisibleChanged += (sender, eventArgs) => { if (Owner != null) { Visible = Owner.Visible; } }; try { Owner.Activated += (sender, args) => Owner.BringToFront(); //Owner.SizeChanged += (sender, eventArgs) => //{ // this.Size = f.Size; //}; } catch (Exception e) { } if (!DesignMode) { Owner.SizeChanged += Owner_SizeChanged; } else { Owner.SizeChanged += Owner_SizeChanged1; } }
public static bool BringToFrontCustom(Form f) { bool toReturn = true; try { //This is the same as the name of the executable without the .exe at the end Process[] processes = Process.GetProcessesByName(f.Name); SetForegroundWindow(processes[0].MainWindowHandle); f.BringToFront(); } catch (Exception e) { toReturn = false; //MessageBox.Show("Something went wrong, Please bring the window to front manually"); } return toReturn; }
/// <summary> /// 获取一个空的win在虚拟空间显示 /// </summary> /// <returns>Form</returns> private static SWF.Form GetShowedTopMostForm() { if (singleTopf == null) { //singleTopf = new SWF.Form(); singleTopf = new EmptyForm(); } singleTopf.Size = new System.Drawing.Size(1, 1); singleTopf.StartPosition = SWF.FormStartPosition.Manual; System.Drawing.Rectangle rect = SWF.SystemInformation.VirtualScreen; singleTopf.Location = new System.Drawing.Point(rect.Bottom + 10, rect.Height + 10); singleTopf.Show(); singleTopf.Focus(); singleTopf.BringToFront(); singleTopf.TopMost = true; return(singleTopf); }
public FirstRunForm(Form parentForm = null) { InitializeComponent(); this.BringToFront(); okButton.Click += (s, e) => { Properties.Settings.Default["hasRunManagerBefore"] = true; Properties.Settings.Default.Save(); if (parentForm != null) { parentForm.Opacity = 1d; parentForm.Show(); parentForm.BringToFront(); } this.Close(); }; }
public Dropshadow(Form f) { Owner = f; ShadowColor = Color.FromArgb(56, 56, 56); // default style FormBorderStyle = FormBorderStyle.None; ShowInTaskbar = false; // bind event Owner.LocationChanged += UpdateLocation; Owner.FormClosing += (sender, eventArgs) => Close(); Owner.VisibleChanged += (sender, eventArgs) => { if (Owner != null) Visible = Owner.Visible; }; Owner.Activated += (sender, args) => Owner.BringToFront(); }
/// <summary> /// Opens a new modeless dialog box with a grid /// </summary> /// <param name="node">the node to display</param> /// <param name="owner">the parent form to attach to, can be null</param> /// <returns>the form containing the grid</returns> public static Form Show(NsNode node, Form owner) { Form f = new Form(); f.Owner = owner; f.SuspendLayout(); NsNodeGridView flow = new NsNodeGridView(); flow.Dock = DockStyle.Fill; f.Controls.Add(flow); f.ResumeLayout(); flow.Node = node; f.StartPosition = FormStartPosition.CenterParent; f.FormBorderStyle = FormBorderStyle.SizableToolWindow; f.Width = 600; f.Height = 300; f.Text = node.Label; f.Show(); f.BringToFront(); flow.ReadNode(); return f; }
public static Form Show(ILogger log, Form owner) { Form f = new Form(); f.Owner = owner; f.SuspendLayout(); LogTextBox box = new LogTextBox(); box.Dock = DockStyle.Fill; box.SetLogText(log); box.AttachLog(log); f.Controls.Add(box); f.ResumeLayout(); f.StartPosition = FormStartPosition.CenterParent; f.FormBorderStyle = FormBorderStyle.SizableToolWindow; f.Width = 500; f.Height = 300; f.Text = ""; f.Show(); f.BringToFront(); return f; }
/// <summary> /// Initializes a new instance of the <see cref="GlowShadowFormAaaaaa"/> class. /// </summary> /// <param name="f">The f.</param> public GlowShadowFormAaaaaa(System.Windows.Forms.Form f) { Owner = f; ShadowColor = Color.Black; // default style FormBorderStyle = FormBorderStyle.None; ShowInTaskbar = false; // bind event Owner.LocationChanged += UpdateLocation; Owner.FormClosing += (sender, eventArgs) => Close(); Owner.VisibleChanged += (sender, eventArgs) => { if (Owner != null) { Visible = Owner.Visible; } }; Owner.Activated += (sender, args) => Owner.BringToFront(); }
//private void onKeyUp(object sender, KeyEventArgs e) { isKeyPressed=false; Print("keyup");} private void OnMouseDownEvent(object sender, MouseButtonEventArgs e) { log("OnMouseDownEvent1"); if (checkForDeregister()) { return; } if (indi_or_strat != null) { log("OnMouseDownEvent1-A"); Point cPos = chartControl.MouseDownPoint; // Coefficient between Bar and it's margin space is 0.65 int posX = (int)ChartingExtensions.ConvertToHorizontalPixels(cPos.X + chartControl.BarWidthArray[0] * 1.65, chartControl.PresentationSource); int slot = (int)chartControl.GetSlotIndexByX(posX); //IBar thebar = GetBarFromX(e.X); //if clicked on visible if (slot >= chartBars.FromIndex && slot <= chartBars.ToIndex) { log("OnMouseDownEvent1-B"); int clicked_Bar = slot; // If Shift + Click , then open form if (System.Windows.Forms.Control.ModifierKeys == Keys.Shift) //isKeyPressed { //isKeyPressed=false; if (logForm == null || logForm.IsDisposed) { createForm(); } if (!logForm.Visible) { logForm.Show(); } } log("OnMouseDownEvent1-C"); // If By this moment, form is/was open, show values if (logForm != null && logForm.Visible) { logForm.BringToFront(); log("OnMouseDownEvent1-D"); if (indi_or_strat.BarsArray[0] != null) { log("OnMouseDownEvent1-E"); Bars bars = indi_or_strat.BarsArray[0]; int barsAgo = indi_or_strat.CurrentBars[0] - clicked_Bar; if (clicked_Bar <= 0) { return; } string bn = Puvox_Library.Methods.barIdentifier(indi_or_strat, barsAgo); string primary = (primaryDict.ContainsKey(bn) ? primaryDict[bn] : ""); /* * string bn_prev = clicked_Bar <= 0 ? "" : Puvox_Library.Methods.barIdentifier( indi_or_strat, barsAgo+1 ); * string secondary=clicked_Bar <= 0 ? "" : ( secondaryDict.ContainsKey(bn_prev) ? secondaryDict[ bn_prev ] : "" ); */ string warning_message = nl + "############ Warning ############" + nl + "Typically, additional (granular) BIP data (except the first one) is used to form the next Primary BAR." + nl + "To understand DataSeries better, must read: - https://goo.gl/ScpDkN" + nl + "##############################" + nl; string secondary = (secondaryDict.ContainsKey(bn) ? warning_message + secondaryDict[bn] : ""); string final_text = primary + secondary; textarea.Text = final_text; Puvox_Library.Methods.DrawVerticalLineBlinking(indi_or_strat, barsAgo); log("OnMouseDownEvent1-F"); } } } } log("OnMouseDownEvent2"); }
void MenuOnClick(string MenuName, string BtnCD) { try { // MessageBox.Show(MenuName + "_" + BtnCD); System.Windows.Forms.Form F = null; Form fc1 = null; this.Cursor = Cursors.WaitCursor; switch (Convert.ToInt32(BtnCD)) { case 1: //Empty break; case 2: /*Internal OS&D * Author: DO.IT*/ //fc1 = Application.OpenForms["FORM_DEFFECTIVE_STATUS"]; //if (fc1 != null) // fc1.Close(); //FORM_DEFFECTIVE_STATUS DEFECTIVE = new FORM_DEFFECTIVE_STATUS(); F = IP.ComVar.DEFECTIVE; break; case 3: /*OS&D * Author: DO.IT*/ fc1 = Application.OpenForms["FRM_SMT_IP_OSD_MONTH"]; if (fc1 != null) { fc1.Close(); } FRM_SMT_IP_OSD_MONTH IN_OSD = new FRM_SMT_IP_OSD_MONTH(); F = IN_OSD; break; case 4: /*Mold OverHoul * Author: Ngọc.IT*/ fc1 = Application.OpenForms["FORM_IP_MOLD_OVERHAUL"]; if (fc1 != null) { fc1.Close(); } FORM_IP_MOLD_OVERHAUL OS_OVERHAUL = new FORM_IP_MOLD_OVERHAUL(); F = OS_OVERHAUL; break; case 5: /*Mold Layout * Author: Ngọc.IT*/ fc1 = Application.OpenForms["FORM_MOLD_PRODUCTION"]; if (fc1 != null) { fc1.Close(); } FORM_MOLD_PRODUCTION OS_LAYOUT = new FORM_MOLD_PRODUCTION(); F = OS_LAYOUT; break; case 6: /*Mold Layout * Author: Ngọc.IT*/ fc1 = Application.OpenForms["FORM_MOLD_ACTUAL_PLAN"]; if (fc1 != null) { fc1.Close(); } FORM_MOLD_ACTUAL_PLAN MOLD_PLAN_ACTUAL = new FORM_MOLD_ACTUAL_PLAN(); F = MOLD_PLAN_ACTUAL; break; case 7: /*Production Status * Author: DO.IT*/ fc1 = Application.OpenForms["FRM_SMT_IP_PROD_DAILY"]; if (fc1 != null) { fc1.Close(); } FRM_SMT_IP_PROD_DAILY PROD_STATS = new FRM_SMT_IP_PROD_DAILY(); F = PROD_STATS; //picContructor.Visible = true; break; case 8: /*OEE MONTH * Author: LUAN.IT*/ fc1 = Application.OpenForms["FRM_SMT_IP_OEE"]; if (fc1 != null) { fc1.Close(); } FRM_SMT_IP_OEE IP_OEE_MON = new FRM_SMT_IP_OEE(); F = IP_OEE_MON; //F = OS_DSF.ComVar.IP_OEE; //picContructor.Visible = !picContructor.Visible; break; case 9: picContructor.Visible = true; break; case 10: fc1 = Application.OpenForms["FORM_INVENTORY_UV_SP"]; if (fc1 != null) { fc1.Close(); } FORM_INVENTORY_UV_SP OS_INV = new FORM_INVENTORY_UV_SP(); F = OS_INV; break; case 11: fc1 = Application.OpenForms["FRM_BOTTOM_INV_SET_ANALYSIS"]; if (fc1 != null) { fc1.Close(); } FRM_BOTTOM_INV_SET_ANALYSIS OS_FSS_INV = new FRM_BOTTOM_INV_SET_ANALYSIS(); F = OS_FSS_INV; break; case 12: /*Absent * Author: NGOC.IT*/ fc1 = Application.OpenForms["FRM_SMT_B_IP_HR_ABSENT"]; if (fc1 != null) { fc1.Close(); } FRM_SMT_B_IP_HR_ABSENT HR_ABSENT = new FRM_SMT_B_IP_HR_ABSENT(); F = HR_ABSENT; break; //case 13: // break; //case 14: // break; case 15: /*LeadTime * Author: NGOC.IT*/ fc1 = Application.OpenForms["FORM_LEADTIME_SYN"]; if (fc1 != null) { fc1.Close(); } FORM_LEADTIME_SYN LEADTIME_OS = new FORM_LEADTIME_SYN(); F = LEADTIME_OS; break; case 16: fc1 = Application.OpenForms["FORM_IP_CHAMBER_ZONE"]; if (fc1 != null) { fc1.Close(); } FORM_IP_CHAMBER_ZONE CHAMBER_ZONE = new FORM_IP_CHAMBER_ZONE(); F = CHAMBER_ZONE; break; case 50: /*BTS * * Author: PHUOC.IT*/ fc1 = Application.OpenForms["FORM_SMT_BTS"]; if (fc1 != null) { fc1.Close(); } FRM_SMT_BTS FRM_SMT_BTS = new FRM_SMT_BTS(); F = FRM_SMT_BTS; break; default: break; } if (F != null) { F.Show(); F.BringToFront(); if (Db.INSERT_FRM_LOG("IP_SMT", this.Name + " (Inside Office)", BtnCD, F.Name, "Open Form", GetIP() + "/" + System.Environment.MachineName)) { } this.Cursor = Cursors.Default; } else { this.Cursor = Cursors.Default; } } catch (Exception ex) { // MessageBox.Show(ex.ToString(), ""); this.Cursor = Cursors.Default; } }
internal void ActivateChild(Form form) { if (Controls.Count < 1) { return; } if (ParentForm.is_changing_visible_state > 0) { return; } Form current = (Form)Controls [0]; bool raise_deactivate = ParentForm.ActiveControl == current; // We want to resize the new active form before it is // made active to avoid flickering. Can't do it in the // normal way (form.WindowState = Maximized) since it's not // active yet and everything would just return to before. // We also won't suspend layout, this way the layout will // happen before the form is made active (and in many cases // before it is visible, which avoids flickering as well). MdiWindowManager wm = (MdiWindowManager)form.WindowManager; if (current.WindowState == FormWindowState.Maximized && form.WindowState != FormWindowState.Maximized && form.Visible) { FormWindowState old_state = form.window_state; SetWindowState(form, old_state, FormWindowState.Maximized, true); wm.was_minimized = form.window_state == FormWindowState.Minimized; form.window_state = FormWindowState.Maximized; SetParentText(false); } form.BringToFront(); form.SendControlFocus(form); SetWindowStates(wm); if (current != form) { form.has_focus = false; if (current.IsHandleCreated) { XplatUI.InvalidateNC(current.Handle); } if (form.IsHandleCreated) { XplatUI.InvalidateNC(form.Handle); } if (raise_deactivate) { MdiWindowManager current_wm = (MdiWindowManager)current.window_manager; current_wm.RaiseDeactivate(); } } active_child = (Form)Controls [0]; if (active_child.Visible) { bool raise_activated = ParentForm.ActiveControl != active_child; ParentForm.ActiveControl = active_child; if (raise_activated) { MdiWindowManager active_wm = (MdiWindowManager)active_child.window_manager; active_wm.RaiseActivated(); } } }
/// <summary> /// Opens a new modeless dialog box with a tree /// </summary> /// <param name="node">the node to display</param> /// <param name="owner">the parent form to attach to, can be null</param> /// <returns>the form containing the tree</returns> public static Form Show(NsNode node, Form owner) { Form f = new Form(); f.Owner = owner; f.SuspendLayout(); NsNodeTree flow = new NsNodeTree(); flow.Dock = DockStyle.Fill; f.Controls.Add(flow); f.ResumeLayout(); flow.AddRootNode(node); f.StartPosition = FormStartPosition.CenterParent; f.FormBorderStyle = FormBorderStyle.SizableToolWindow; f.Width = 150; f.Height = 300; f.Text = ""; flow.SelectionChanged += delegate(object s, NodeEventArgs ne) { if (ne.Node == null) f.Close(); }; f.FormClosed += delegate(object s, FormClosedEventArgs e) { if (flow.SelectedRoot != null) flow.SelectedRoot.Detach(flow); }; f.Show(); f.BringToFront(); return f; }
// ... just setting .TopMost sometimes does not work public static void bring_to_topmost(Form form) { form.Activated += FormOnActivated; form.BringToFront(); form.Focus(); form.Activate(); }
public static void bring_to_top(Form form) { form.BringToFront(); form.Focus(); form.Activate(); form.TopMost = true; form.TopMost = false; }
void MenuOnClick(string MenuName, string BtnCD) { try { // MessageBox.Show(MenuName + "_" + BtnCD); System.Windows.Forms.Form F = null; Form fc1 = null; this.Cursor = Cursors.WaitCursor; switch (Convert.ToInt32(BtnCD)) { case 1: //Empty break; case 2: /*Internal OS&D * Author: DO.IT*/ fc1 = Application.OpenForms["FRM_SMT_IP_OSD_MONTH"]; if (fc1 != null) { fc1.Close(); } FRM_SMT_IP_OSD_MONTH IN_OSD = new FRM_SMT_IP_OSD_MONTH(); F = IN_OSD; break; case 3: /*External OS&D * Author: DO.IT*/ fc1 = Application.OpenForms["FRM_SMT_OS_OSD_EXT_MONTH"]; if (fc1 != null) { fc1.Close(); } FRM_SMT_OS_OSD_EXT_MONTH EXT_OSD = new FRM_SMT_OS_OSD_EXT_MONTH(); F = EXT_OSD; break; case 4: /*Mold OverHoul * Author: Ngọc.IT*/ fc1 = Application.OpenForms["FORM_IP_MOLD_OVERHAUL"]; if (fc1 != null) { fc1.Close(); } FORM_IP_MOLD_OVERHAUL OS_OVERHAUL = new FORM_IP_MOLD_OVERHAUL(); F = OS_OVERHAUL; break; case 5: /*Mold Layout * Author: Ngọc.IT*/ fc1 = Application.OpenForms["FORM_OS_MACHINE_LAYOUT"]; if (fc1 != null) { fc1.Close(); } FORM_OS_MACHINE_LAYOUT OS_LAYOUT = new FORM_OS_MACHINE_LAYOUT(); F = OS_LAYOUT; break; case 6: /*Mold Layout * Author: Ngọc.IT*/ fc1 = Application.OpenForms["FRM_SMT_OS_MOLD_ACTUAL_PLAN"]; if (fc1 != null) { fc1.Close(); } FRM_SMT_OS_MOLD_ACTUAL_PLAN MOLD_PLAN_ACTUAL = new FRM_SMT_OS_MOLD_ACTUAL_PLAN(); F = MOLD_PLAN_ACTUAL; break; case 7: /*Production Status * Author: DO.IT*/ fc1 = Application.OpenForms["FRM_SMT_OS_PROD_DAILY"]; if (fc1 != null) { fc1.Close(); } FRM_SMT_OS_PROD_DAILY PROD_STATS = new FRM_SMT_OS_PROD_DAILY(); F = PROD_STATS; break; case 8: /*OEE MONTH * Author: LUAN.IT*/ fc1 = Application.OpenForms["FRM_SMT_OS_OEE"]; if (fc1 != null) { fc1.Close(); } Machinery.FRM_SMT_OS_OEE OS_OEE = new Machinery.FRM_SMT_OS_OEE(); F = OS_OEE; break; case 9: break; case 10: fc1 = Application.OpenForms["FRM_SMT_OS_INVENTORY"]; if (fc1 != null) { fc1.Close(); } FRM_SMT_OS_INVENTORY OS_INV = new FRM_SMT_OS_INVENTORY(); F = OS_INV; break; case 11: fc1 = Application.OpenForms["FRM_SMT_OS_FSS_INVENTORY"]; if (fc1 != null) { fc1.Close(); } FRM_SMT_OS_FSS_INVENTORY OS_FSS_INV = new FRM_SMT_OS_FSS_INVENTORY(); F = OS_FSS_INV; break; break; case 12: /*Absent * Author: NGOC.IT*/ fc1 = Application.OpenForms["FRM_SMT_OS_HR_ABSENT"]; if (fc1 != null) { fc1.Close(); } FRM_SMT_OS_HR_ABSENT HR_ABSENT = new FRM_SMT_OS_HR_ABSENT(); F = HR_ABSENT; break; case 13: break; case 14: break; case 15: ///*LeadTime // Author: NGOC.IT*/ //fc1 = Application.OpenForms["FORM_SMT_OS_LEADTIME"]; //if (fc1 != null) // fc1.Close(); //FORM_SMT_OS_LEADTIME LEADTIME_OS = new FORM_SMT_OS_LEADTIME(); //F = LEADTIME_OS; break; default: break; } if (F != null) { F.Show(); F.BringToFront(); if (Db.INSERT_FRM_LOG("OS_SMT", this.Name + " (Inside Office)", BtnCD, F.Name, "Open Form", GetIP() + "/" + System.Environment.MachineName)) { } this.Cursor = Cursors.Default; } else { this.Cursor = Cursors.Default; } } catch { this.Cursor = Cursors.Default; } }
private void FormToFront(Form f) { // Make this form the active form and make it TopMost //f.ShowInTaskbar = false; /*f.TopMost = true; f.Focus();*/ f.BringToFront(); // f.TopMost = false; }
public static void ErrorBox(Form owner, string message) { Project.mainForm.BringToFront(); if(owner == null) { owner = mainForm; } else { owner.BringToFront(); } try { // owner.Activate(); ErrorBoxForm errorBoxForm = new ErrorBoxForm(message); errorBoxForm.ShowDialog(); // System.Windows.Forms.MessageBox.Show (owner, // message, Project.PROGRAM_NAME_HUMAN, // System.Windows.Forms.MessageBoxButtons.OK, MessageBoxIcon.Error); } catch {} }
public static bool YesNoBox(Form owner, string message) { Project.mainForm.BringToFront(); if(owner == null) { owner = mainForm; } else { owner.BringToFront(); } try { owner.Activate(); return (System.Windows.Forms.MessageBox.Show (owner, message, Project.PROGRAM_NAME_HUMAN, System.Windows.Forms.MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes); } catch { return false; } }
public static void MessageBox(Form owner, string message) { Project.mainForm.BringToFront(); if(owner == null) { owner = mainForm; } else { owner.BringToFront(); } try { owner.Activate(); System.Windows.Forms.MessageBox.Show (owner, message, Project.PROGRAM_NAME_HUMAN, System.Windows.Forms.MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } catch {} }
// Display windows dialog private void zDisplayDialog(Form poParentForm, int piDialog) { int i = -1; int iHandle = 0; //get parent handle if(poParentForm!=null) { iHandle = poParentForm.Handle.ToInt32(); } //show dialog if(piDialog==1) { i = WNetConnectionDialog(iHandle, RESOURCETYPE_DISK); }else if(piDialog==2) { i = WNetDisconnectDialog(iHandle, RESOURCETYPE_DISK); } if(i>0){throw new System.ComponentModel.Win32Exception(i);} //set focus on parent form poParentForm.BringToFront(); }
public async Task ExportAsync(string outputFile, bool generateManifest, Form callerForm) { IsCancelled = false; RaiseMessage("Exportation started", Color.Blue); ReportProgressChanged(0); var babylonScene = new BabylonScene(Path.GetDirectoryName(outputFile)); var maxScene = Loader.Core.RootNode; alreadyExportedTextures.Clear(); if (!Directory.Exists(babylonScene.OutputPath)) { RaiseError("Exportation stopped: Output folder does not exist"); ReportProgressChanged(100); return; } var watch = new Stopwatch(); watch.Start(); // Save scene RaiseMessage("Saving 3ds max file"); if (AutoSave3dsMaxFile) { var forceSave = Loader.Core.FileSave; if (callerForm != null) { callerForm.BringToFront(); } } // Global babylonScene.autoClear = true; babylonScene.clearColor = Loader.Core.GetBackGround(0, Tools.Forever).ToArray(); babylonScene.ambientColor = Loader.Core.GetAmbient(0, Tools.Forever).ToArray(); babylonScene.gravity = maxScene.GetVector3Property("babylonjs_gravity"); exportQuaternionsInsteadOfEulers = maxScene.GetBoolProperty("babylonjs_exportquaternions", 1); // Cameras BabylonCamera mainCamera = null; RaiseMessage("Exporting cameras"); foreach (var cameraNode in maxScene.NodesListBySuperClass(SClass_ID.Camera)) { ExportCamera(cameraNode, babylonScene); if (mainCamera == null && babylonScene.CamerasList.Count > 0) { mainCamera = babylonScene.CamerasList[0]; babylonScene.activeCameraID = mainCamera.id; RaiseMessage("Active camera set to " + mainCamera.name, Color.Green, 1, true); } } if (mainCamera == null) { RaiseWarning("No camera defined", 1); } else { RaiseMessage(string.Format("Total: {0}", babylonScene.CamerasList.Count), Color.Gray, 1); } // Fog for (var index = 0; index < Loader.Core.NumAtmospheric; index++) { var atmospheric = Loader.Core.GetAtmospheric(index); if (atmospheric.Active(0) && atmospheric.ClassName == "Fog") { var fog = atmospheric as IStdFog; if (fog != null) { RaiseMessage("Exporting fog"); babylonScene.fogColor = fog.GetColor(0).ToArray(); babylonScene.fogDensity = fog.GetDensity(0); babylonScene.fogMode = fog.GetType_ == 0 ? 3 : 1; if (mainCamera != null) { babylonScene.fogStart = mainCamera.minZ*fog.GetNear(0); babylonScene.fogEnd = mainCamera.maxZ*fog.GetFar(0); } } } } // Meshes ReportProgressChanged(10); RaiseMessage("Exporting meshes"); var meshes = maxScene.NodesListBySuperClasses(new[] { SClass_ID.Geomobject, SClass_ID.Helper }); var progressionStep = 80.0f / meshes.Count(); var progression = 10.0f; foreach (var meshNode in meshes) { Tools.PreparePipeline(meshNode, true); ExportMesh(meshNode, babylonScene); Tools.PreparePipeline(meshNode, false); progression += progressionStep; ReportProgressChanged((int)progression); CheckCancelled(); } RaiseMessage(string.Format("Total: {0}", babylonScene.MeshesList.Count), Color.Gray, 1); // Materials RaiseMessage("Exporting materials"); var matsToExport = referencedMaterials.ToArray(); // Snapshot because multimaterials can export new materials foreach (var mat in matsToExport) { ExportMaterial(mat, babylonScene); CheckCancelled(); } RaiseMessage(string.Format("Total: {0}", babylonScene.MaterialsList.Count + babylonScene.MultiMaterialsList.Count), Color.Gray, 1); // Lights RaiseMessage("Exporting lights"); foreach (var lightNode in maxScene.NodesListBySuperClass(SClass_ID.Light)) { ExportLight(lightNode, babylonScene); CheckCancelled(); } if (babylonScene.LightsList.Count == 0) { RaiseWarning("No light defined", 1); RaiseWarning("A default hemispheric light was added for your convenience", 1); ExportDefaultLight(babylonScene); } else { RaiseMessage(string.Format("Total: {0}", babylonScene.LightsList.Count), Color.Gray, 1); } // Skeletons if (skins.Count > 0) { RaiseMessage("Exporting skeletons"); foreach (var skin in skins) { ExportSkin(skin, babylonScene); skin.Dispose(); } } // Output RaiseMessage("Saving to output file"); babylonScene.Prepare(false); var jsonSerializer = JsonSerializer.Create(); var sb = new StringBuilder(); var sw = new StringWriter(sb, CultureInfo.InvariantCulture); await Task.Run(() => { using (var jsonWriter = new JsonTextWriterOptimized(sw)) { jsonWriter.Formatting = Formatting.None; jsonSerializer.Serialize(jsonWriter, babylonScene); } File.WriteAllText(outputFile, sb.ToString()); if (generateManifest) { File.WriteAllText(outputFile + ".manifest", "{\r\n\"version\" : 1,\r\n\"enableSceneOffline\" : true,\r\n\"enableTexturesOffline\" : true\r\n}"); } }); ReportProgressChanged(100); watch.Stop(); RaiseMessage(string.Format("Exportation done in {0:0.00}s", watch.ElapsedMilliseconds / 1000.0), Color.Blue); }