Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //public partial class HotKeyWin : Window // WindowStyle="ToolWindow"
- public partial class NotifyIconWrapper : Component
- {
- private HotKeyWin hkeyWin = new HotKeyWin();
- public NotifyIconWrapper()
- {
- hkeyWin.Show();
- hkeyWin.Closing += new CancelEventHandler(hkeyWin_Closing);
- hkeyWin.Hide();
- }
- void hkeyWin_Closing(object sender, CancelEventArgs e)
- {
- Console.WriteLine("hkeyWin_Closing enter");
- e.Cancel = true;
- }
- private void contextMenuStrip2_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
- {
- if (e.Alt) hkeyWin.Activate();
- }
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- this.Activated += new EventHandler(Form1_Activated);
- }
- void Form1_Activated(object sender, EventArgs e)
- {
- string iconPath = "some file system path";
- notifyIcon1.Icon = new Icon(iconPath);
- }
- public mainForm_keypressed(object sender, //eventargs
- {
- if(_hidden && //Keystroke detection)
- {
- e.Handled = true;
- return;
- }
- }
- private void myMenuTray_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
- {
- if (e.KeyCode == Keys.Menu && e.KeyValue == 18 && e.Alt)
- {
- MessageBox.Show("");
- MessageBox.Show("YOU CAN'T CLOSE HERE WITH ALT-F4");
- return;
- }
- }
Add Comment
Please, Sign In to add comment