public partial class Form1 : Form { private const int SW_SHOWNA = 4; [System.Runtime.InteropServices.DllImport("user32.dll")] private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); private Timer timer; public Form1() { InitializeComponent(); timer = new Timer(); timer.Interval = 2000; timer.Tick += Timer_Tick; timer.Enabled = true; } private void Timer_Tick(object sender, EventArgs e) { Console.WriteLine("Raised: {0}", e.ToString()); //this.Visible = true; //this.BringToFront(); this.Activate(); ShowWindow(this.Handle, SW_SHOWNA); //this.Show(); } protected override bool ShowWithoutActivation { get { return true; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)