writing custom event for minimise, restore and close buttons

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an example of code that allows and application to minise to the
notification tray but how can I override the minimise and close buttons to
ensure they always go back to the notify tray instead of closing the
application or minimising the the taskbar?

I am sure this must be simple I just can't find any information about it.
 
smarty said:
I have an example of code that allows and application to minise to the
notification tray but how can I override the minimise and close buttons to
ensure they always go back to the notify tray instead of closing the
application or minimising the the taskbar?

I am sure this must be simple I just can't find any information about it.
why dont you check the window state in form resize event, if the window
state is minimized then write code to send your application to the
notification area.
regards
Vilsad
 
Thanks for the replay. I have used the resize event and this works fine for
minimising to the task tray but not sure how to override the X close event to
minimise to task tray.

Any ideas?
 
smarty said:
Thanks for the replay. I have used the resize event and this works fine for
minimising to the task tray but not sure how to override the X close event to
minimise to task tray.

Any ideas?


:
you can use the formclosing event to override the closing of your
window, use e.cancel to cancel the closing and use your code to redirect
the window to the notification area

regards
Vilsad
 
you can use the formclosing event to override the closing of your
window, use e.cancel to cancel the closing and use your code to redirect
the window to the notification area

regards
Vilsad
 
Hi Smarty,

Thanks for your posting!
"but not sure how to override the X close event to minimise to task tray."

Overriding the form_onclosing method in VB.NET likes below:
Protected Overrides Sub OnClosing(ByVal e As
System.ComponentModel.CancelEventArgs)
e.Cancel = True
Me.Hide()
MyBase.OnClosing(e)
End Sub

Actually, if you want to implement minimize to tray, there is an
appropriate article demonstrates how to approach this:
http://www.pixvillage.com/blogs/devblog/archive/2005/03/26/174.aspx

Unfortunately, the article is for VB.NET version. So, if you have any
concerns or issues, please feel you free to let me know. It's my pleasure
to be a future assistance!

Regards,

Yuan Ren [MSFT]
Microsoft Online Support
======================================================
PLEASE NOTE the newsgroup SECURE CODE and PASSWORD were
updated on February 14, 2006. Please complete a re-registration process
by entering the secure code mmpng06 when prompted. Once you have
entered the secure code mmpng06, you will be able to update your profile
and access the partner newsgroups.
======================================================
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from this issue.
======================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
======================================================
 
Back
Top