System.Windows.Forms.Form.Activate()

Here are the examples of the csharp api class System.Windows.Forms.Form.Activate() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

161 Examples 7

1. Example

Project: Krypton
Source File: ViewDrawRibbonQATButton.cs
private void OnClick(object sender, MouseEventArgs e)
        {
            // We do not operate the qat button at design time
            if (!_ribbon.InDesignMode)
            {
                Form ownerForm = _ribbon.FindForm();

                // Ensure the form we are inside is active
                if (ownerForm != null)
                    ownerForm.Activate();

                // Inform quick access toolbar button it has been clicked
                _qatButton.PerformClick();
            }
        }

2. Example

Project: NSMB-Editor
Source File: MdiParentForm.cs
private void MdiParentForm_Load(object sender, EventArgs e)
        {
            LevelChooser lc = new LevelChooser();
            lc.MdiParent = this;
            lc.Show();
            
            //For some reason, without this, the MDI form is created behind other windows. WTF?
            this.Activate();
        }

3. Example

Project: LiteDBViewer
Source File: PasswordForm.cs
private void PasswordForm_Load(object sender, EventArgs e)
        {
            Activate();
        }

4. Example

Project: NiVirtualCam
Source File: frm_Main.cs
private void NotifyMouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                if (!this.Visible)
                {
                    this.Visible = true;
                }
                this.Activate();
            }
        }

5. Example

Project: ImageVisualizer
Source File: ImageVisualizerForm.cs
private void ImageVisualizerForm_Shown(object sender, EventArgs e)
        {
            Activate();
        }

6. Example

Project: Bulk-Crap-Uninstaller
Source File: EntryPoint.cs
protected override void OnStartupNextInstance(StartupNextInstanceEventArgs eventArgs)
            {
                try
                {
                    MainForm?.Activate();
                }
                catch (Exception ex)
                {
                    PremadeDialogs.GenericError(ex);
                }
            }

7. Example

Project: ScpToolkit
Source File: ScpForm.cs
private void niTray_Click(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Left) return;

            if (WindowState == FormWindowState.Minimized)
            {
                WindowState = FormWindowState.Normal;
                Visible = true;

                Activate();
            }
            else
            {

                if (_profiles.Visible) _profiles.Hide();

                Visible = false;
                WindowState = FormWindowState.Minimized;
            }
        }

8. Example

Project: nHydrate
Source File: RunningProcesses.cs
public void Update(string text, bool topMost, int timeout)
        {
            lblText.Text = text;
            this.TopMost = topMost;
            var tick = (timeout * 1000) / 100;
            if (tick <= 0) tick = 100;
            timer1.Interval = tick;
            this.Activate();
        }

9. Example

Project: poderosa
Source File: MainForm.cs
private void OnTaskTrayIconDoubleClicked(object sender, EventArgs args) {
            if (this.WindowState == FormWindowState.Minimized) {
                this.Visible = true;
                this.WindowState = FormWindowState.Normal;
                this.ShowInTaskbar = Env.Options.ShowInTaskBar;
            }
            this.Activate();
        }

10. Example

Project: WYZTracker
Source File: frmDockedMain.cs
private void editor_InstrumentChanged(object sender, EventArgs e)
        {
            this.patEditor.Invalidate();

            Form senderForm = sender as Form;
            if (senderForm != null)
            {
                senderForm.Activate();
            }
        }

11. Example

Project: NClass
Source File: CrashReport.cs
private void CrashReport_Shown(object sender, EventArgs e)
        {
            Activate();
            textBoxEmail.Select();
        }

12. Example

Project: UpDown-Meter
Source File: NetGraphForm.cs
private void ToggleWindowVisibility() {
            if (Visible = !Visible) {
                Activate();
            }
        }

13. Example

Project: SquareOne
Source File: ChartControl.ChartShadowProtocol.cs
public void ActivateParentForm() {
			Form parent = this.Parent as Form;
			if (parent != null) {
				parent.Activate();
			} else {
				string msg = "Chart::ActivateParentForm() chart[" + this + "].Parent is not a Form, can not Activate()";
				Assembler.PopupException(msg);
			}
		}

14. Example

Project: WGestures
Source File: Warn360.cs
private void Warn360_Load(object sender, EventArgs e)
        {
            tb_wgPath.Text = Application.ExecutablePath;
            Activate();
        }

15. Example

Project: WGestures
Source File: SearchBox.cs
private void SearchBox_Shown(object sender, System.EventArgs e)
        {
            Activate();
        }

16. Example

Project: BloomDesktop
Source File: EditingModel.cs
private void ReactivateFormOnIdle(object sender, EventArgs eventArgs)
		{
			Application.Idle -= ReactivateFormOnIdle;
			if (_oldActiveForm != null)
				_oldActiveForm.Activate();
		}

17. Example

Project: rhino-tools
Source File: WinFormGenericUserInterface.cs
private void WinFormGenericUserInterface_Load(object sender, EventArgs e)
        {
            Activate();
        }

18. Example

Project: Krypton
Source File: ViewDrawRibbonQATExtraButton.cs
private void OnClick(object sender, MouseEventArgs e)
        {
            Form ownerForm = _ribbon.FindForm();

            // Ensure the form we are inside is active
            if (ownerForm != null)
                ownerForm.Activate();

            if ((ClickAndFinish != null) && !_ribbon.InDesignMode)
                ClickAndFinish(this, _finishDelegate);
            else
                ClickFinished(this, EventArgs.Empty);
        }

19. Example

Project: JiraSVN
Source File: IssuesList.cs
private void Form_Load(object sender, EventArgs e)
		{
			_serializer.Deserialize(new CSharpTest.Net.Serialization.StorageClasses.RegistryStorage());
            showTimeTrackingToolStripMenuItem.Checked = worklogpanel.Visible;
			this.Activate();
		}

20. Example

Project: CubePdf
Source File: MainForm.cs
protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);

            SettingButton.Enabled = false;
            Activate();
            TopMost = true;
            TopMost = false;
        }

21. Example

Project: MapleShark
Source File: DockContentHandler.cs
public void Activate()
		{
			if (DockPanel == null)
				Form.Activate();
			else if (Pane == null)
				Show(DockPanel);
			else
			{
				IsHidden = false;
				Pane.ActiveContent = Content;
                if (DockState == DockState.Document && DockPanel.DocumentStyle == DocumentStyle.SystemMdi)
                {
                    Form.Activate();
                    return;
                }
                else if (DockHelper.IsDockStateAutoHide(DockState))
                    DockPanel.ActiveAutoHideContent = Content;

                if (!Form.ContainsFocus)
                    DockPanel.ContentFocusManager.Activate(Content);
			}
		}

22. Example

Project: dockpanelsuite
Source File: DockContentHandler.cs
public void Activate()
        {
            if (DockPanel == null)
                Form.Activate();
            else if (Pane == null)
                Show(DockPanel);
            else
            {
                IsHidden = false;
                Pane.ActiveContent = Content;
                if (DockState == DockState.Document && DockPanel.DocumentStyle == DocumentStyle.SystemMdi)
                {
                    Form.Activate();
                    return;
                }
                else if (DockHelper.IsDockStateAutoHide(DockState))
                {
                    if (DockPanel.ActiveAutoHideContent != Content)
                    {
                        DockPanel.ActiveAutoHideContent = null;
                        return;
                    }
                }

                if (Form.ContainsFocus)
                    return;

                if (Win32Helper.IsRunningOnMono)
                    return;

                DockPanel.ContentFocusManager.Activate(Content);
            }
        }

23. Example

Project: dockpanelsuite
Source File: DragForm.cs
public virtual void Show(bool bActivate)
        {
            Show();

            if (bActivate)
                Activate();
        }

24. Example

Project: bio
Source File: SelectionHelper.cs
void Application_SheetSelectionChange(object changedSheet, Microsoft.Office.Interop.Excel.Range changedRange)
        {
            string address = selectionText.Text;
            selectionText.Text = selectionText.Text.Substring(0, lastManualComma);
          
            Range selection = Globals.ThisAddIn.Application.Selection as Range;
            foreach (Range r in selection.Areas)
            {
                // Append the new selection
                if (!string.IsNullOrWhiteSpace(selectionText.Text) && selectionText.Text[selectionText.TextLength - 1] != ',')
                    selectionText.Text += ",";

                selectionText.Text += r.Worksheet.Name + "!" + r.Address.Replace("$", "");
            }

            this.Activate();
            this.selectionText.Focus();
            this.selectionText.SelectionStart = this.selectionText.TextLength;
        }

25. Example

Project: ArnoldSimulator
Source File: DockContentHandler.cs
public void Activate()
        {
            if (DockPanel == null)
                Form.Activate();
            else if (Pane == null)
                Show(DockPanel);
            else
            {
                IsHidden = false;
                Pane.ActiveContent = Content;
                if (DockState == DockState.Document && DockPanel.DocumentStyle == DocumentStyle.SystemMdi)
                {
                    Form.Activate();
                    return;
                }
                else if (DockHelper.IsDockStateAutoHide(DockState))
                {
                    if (DockPanel.ActiveAutoHideContent != Content)
                    {
                        DockPanel.ActiveAutoHideContent = null;
                        return;
                    }
                }

                if (Form.ContainsFocus) 
                    return;

                if (Win32Helper.IsRunningOnMono) 
                    return;

                DockPanel.ContentFocusManager.Activate(Content);
            }
        }

26. Example

Project: ArnoldSimulator
Source File: DragForm.cs
public virtual void Show(bool bActivate)
        {
                Show();

                if (bActivate)
                    Activate();
        }

27. Example

Project: spdif-ka
Source File: SPDIFGUI.cs
private void Restore() {
            this.IsAppVisible = true;
            this.ShowInTaskbar = true;
            this.WindowState = FormWindowState.Normal;
            this.Show();
            this.Activate();
        }

28. Example

Project: KeeThief
Source File: MainForm.cs
private void OnTrayTray(object sender, EventArgs e)
		{
			if(GlobalWindowManager.ActivateTopWindow()) return;
			if(!IsCommandTypeInvokable(null, AppCommandType.Window))
			{
				// If a non-Form window is being displayed, activate it
				// indirectly by activating the main window
				if(GlobalWindowManager.WindowCount > 0)
				{
					try { this.Activate(); }
					catch(Exception) { Debug.Assert(false); }
				}

				return;
			}

			if((this.WindowState == FormWindowState.Minimized) && !IsTrayed())
			{
				if(Program.Config.MainWindow.Maximized)
					UIUtil.SetWindowState(this, FormWindowState.Maximized);
				else UIUtil.SetWindowState(this, FormWindowState.Normal);
				return;
			}

			bool bTray = !IsTrayed();
			MinimizeToTray(bTray);
			if(!bTray) EnsureVisibleForegroundWindow(false, false);
		}

29. Example

Project: KeeThief
Source File: MainForm.cs
private void OnFormActivated(object sender, EventArgs e)
		{
			NotifyUserActivity();

			// if(m_vRedirectActivation.Count > 0)
			// {
			//	Form f = m_vRedirectActivation.Peek();
			//	if(f != null) f.Activate();
			//	// SystemSounds.Beep.Play(); // Do not beep!
			// }
			// // else EnsureAlwaysOnTopOpt();

			try
			{
				Form fTop = GlobalWindowManager.TopWindow;
				if((fTop != null) && (fTop != this) && !m_bInActRedir)
				{
					m_bInActRedir = true;
					try { fTop.Activate(); }
					finally { m_bInActRedir = false; }
				}
			}
			catch(Exception) { Debug.Assert(false); }
		}

30. Example

Project: KeeThief
Source File: GlobalWindowManager.cs
internal static bool ActivateTopWindow()
		{
			try
			{
				Form f = GlobalWindowManager.TopWindow;
				if(f == null) return false;

				f.Activate();
				return true;
			}
			catch(Exception) { Debug.Assert(false); }

			return false;
		}

31. Example

Project: IceChat
Source File: FormMain.cs
private void NotifyIconMouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (this.Visible == true)
            {
                this.Activate();

                if (this.WindowState == FormWindowState.Minimized)
                {
                    this.WindowState = FormWindowState.Normal;
                }
            }
            else
            {
                this.iceChatOptions.IsOnTray = false;
                this.Show();
                this.WindowState = previousWindowState;
                this.notifyIcon.Visible = iceChatOptions.ShowSytemTrayIcon;
            }
        }

32. Example

Project: superputty
Source File: WindowActivator.cs
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 : "?");

                // bring to top
                form.TopMost = true;
                form.TopMost = false;

                // set as active form in task bar
                form.Activate();

                // stop flashing...happens occassionally when switching quickly when activate manuver is fails
                NativeMethods.FlashWindow(form.Handle, NativeMethods.FLASHW_STOP);
            }
        }

33. Example

Project: superputty
Source File: WindowActivator.cs
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 : "?");

                // Send press of Alt key so that the main window can be activated w/o user interaction
                NativeMethods.keybd_event(VK_MENU, 0xb8, 0, 0);
                // Activate main window
                form.Activate();
                // Release Alt key
                NativeMethods.keybd_event(VK_MENU, 0xb8, KEYEVENTF_KEYUP, 0);

                // Set foreground back to terminal window
                //NativeMethods.SetForegroundWindow(hwnd);
            }

        }

34. Example

Project: lua-tilde
Source File: DockContentHandler.cs
public void Activate()
		{
			if (DockPanel == null)
				Form.Activate();
			else if (Pane == null)
				Show(DockPanel);
			else
			{
				IsHidden = false;
				Pane.ActiveContent = Content;
                if (DockState == DockState.Document && DockPanel.DocumentStyle == DocumentStyle.SystemMdi)
                {
                    Form.Activate();
                    return;
                }
                else if (DockHelper.IsDockStateAutoHide(DockState))
                    DockPanel.ActiveAutoHideContent = Content;

                if (!Form.ContainsFocus)
                    DockPanel.ContentFocusManager.Activate(Content);
			}
		}

35. Example

Project: fdotoolbox
Source File: ManagerForm.cs
public static void ShowForm()
        {
            if (instance == null)
            {
                instance = new ManagerForm();
                instance.Show();
            }
            else
            {
                instance.Activate();
            }
        }

36. Example

Project: Bulk-Crap-Uninstaller
Source File: InternalLogViewer.cs
private void NotifyIcon_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (WindowState == FormWindowState.Minimized)
            {
                WindowState = FormWindowState.Normal;
            }

            Show();
            Activate();
        }

37. Example

Project: lphant
Source File: eLePhantForm.cs
private void notifyIcon1_DoubleClick(object sender, System.EventArgs e)
		{
			Show();
			Activate();
			WindowState=m_PreviousState;
		}

38. Example

Project: v2ray-taskbar
Source File: MainForm.cs
void notifyIconV2ray_MouseClick(object sender, MouseEventArgs e)
		{
			if (this.Visible == false && e.Button == MouseButtons.Left) {
				this.Visible = true;
				this.WindowState = FormWindowState.Normal;
				this.Activate();
				this.textBoxTaskbar.SelectionStart = this.textBoxTaskbar.Text.Length;
				this.textBoxTaskbar.ScrollToCaret();
			} else if (e.Button == MouseButtons.Left) {
				this.Hide();
				this.Visible = false;
			}
		}

39. Example

Project: windows-app
Source File: MainForm.cs
private void Restore()
		{
			WindowState = FormWindowState.Normal;
			this.Show();
			this.Activate();
		}

40. Example

Project: betterpoeditor
Source File: SuggestionForm.cs
private void CancelBtn_Click(object sender, System.EventArgs e)
		{
			this.Hide();
			if (this.Owner != null) this.Owner.Activate();
		}

41. Example

Project: betterpoeditor
Source File: SuggestionForm.cs
private void SpellingForm_Closing(object sender, System.ComponentModel.CancelEventArgs e)
		{
			e.Cancel = true;
			this.Hide();
			if (this.Owner != null) this.Owner.Activate();
		}

42. Example

Project: Nexus-Mod-Manager
Source File: DockContentHandler.cs
public void Activate()
        {
            if (DockPanel == null)
                Form.Activate();
            else if (Pane == null)
                Show(DockPanel);
            else
            {
                IsHidden = false;
                Pane.ActiveContent = Content;
                if (DockState == DockState.Document && DockPanel.DocumentStyle == DocumentStyle.SystemMdi)
                {
                    Form.Activate();
                    return;
                }
                else if (DockHelper.IsDockStateAutoHide(DockState))
                {
                    if (DockPanel.ActiveAutoHideContent != Content)
                    {
                        DockPanel.ActiveAutoHideContent = null;
                        return;
                    }
                }

                if (Form.ContainsFocus) 
                    return;

                if (Win32Helper.IsRunningOnMono) 
                    return;

                DockPanel.ContentFocusManager.Activate(Content);
            }
        }

43. Example

Project: Nexus-Mod-Manager
Source File: DragForm.cs
public virtual void Show(bool bActivate)
        {
                Show();

                if (bActivate)
                    Activate();
        }

44. Example

Project: cs-script.npp
Source File: GUIMainForm.cs
private void MainForm_Load(object sender, System.EventArgs e)
        {
            this.KeyPreview = true;
            Activate();


            this.InitHelperWindows();
        }

45. Example

Project: OpenLiveWriter
Source File: ControlHelper.cs
public static void ActivateTopLevelWindow(Control control)
        {
            //	Prevent stupidity.
            if (control == null || !control.IsHandleCreated)
                return;

            //	Find the form that contains the control.  If it's found, we get off easy, and can
            //	activate it natively through .NET.
            Form form = control.FindForm();
            if (form != null)
                form.Activate();
            else
                User32.BringWindowToTop(control.Handle);
        }

46. Example

Project: Aspose.Words-for-.NET
Source File: DocumentPreviewAndPrint.cs
protected override void OnShown(EventArgs e)
        {
            Activate();
            base.OnShown(e);
        }

47. Example

Project: HostsFileEditor
Source File: FormExtensions.cs
public static void ShowOrActivate(this Form form)
        {
            if (form.Visible)
            {
                form.Activate();
            }
            else
            {
                form.Show();
            }
        }

48. Example

Project: GEDKeeper
Source File: MapsViewerWin.cs
public void ProcessMap()
        {
            AppHost.Instance.ShowWindow(this);
            PlacesLoad();
            Activate();
        }

49. Example

Project: AudioSwitch
Source File: FormSwitcher.cs
private void notifyIcon1_MouseUp(object sender, MouseEventArgs e)
        {
            if (DeactivatedOnIcon)
            {
                DeactivatedOnIcon = false;
                return;
            }

            VolBar.RegisterDevice(RenderType);

            if (e.Button == MouseButtons.Left)
            {
                timer1.Enabled = true;
                Show();
                Activate();
            }
        }

50. Example

Project: snaketail-net
Source File: MainForm.cs
private void _trayIcon_DoubleClick(object sender, EventArgs e)
        {
            Show();
            WindowState = FormWindowState.Normal;
            Activate();
         }