private void HandleTrayClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { var preview = new Preview(); int x = Cursor.Position.X - preview.Size.Width; int y = Cursor.Position.Y - preview.Size.Height - 10; if (y < 0) { y = Cursor.Position.Y; } if (x < 0) { x = Cursor.Position.X; // Taskbar may be on left side } preview.SetDesktopLocation(x, y); preview.Show(); } }
private void HandleTrayClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { var preview = new Preview(); int x = Cursor.Position.X - preview.Size.Width; int y = Cursor.Position.Y - preview.Size.Height - 10; if (y < 0) y = Cursor.Position.Y; if (x < 0) x = Cursor.Position.X; // Taskbar may be on left side preview.SetDesktopLocation(x, y); preview.Show(); } }