Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- How do I make the close button of a Windows Form not close the form but make it invisible?
- protected override void OnFormClosing(FormClosingEventArgs e) {
- if (IActuallyWantToCloseFlag)
- return;
- var ni = new NotifyIcon(this.components)
- {
- Icon = someIcon,
- Text = "My text",
- Visible = true
- };
- ni.DoubleClick += (sender, args) => { this.Show(); };
- this.Hide();
- e.Cancel = true;
- }
- FormClosing += (sender, args) => { args.Cancel = true; Visible = false; };
Add Comment
Please, Sign In to add comment