The first line sets the background bitmap skin and transparency color (must be present), and the second line sets the 3-State close button with its transparency color and its location on the window (this line is optional if you don't want a close button).
Since I wanted to keep only managed code, I used the Screen.GetWorkingArea(WorkAreaRectangle) function instead of using unmanaged code to get the taskbar position. As a result, I made the popup always appear at the bottom of WorkAreaRectangle whichever position the taskbar has.
I didn't find any C# managed equivalent to the Win32 function ShowWindow(SW_SHOWNOACTIVATE) to make the popup, not steal the focus of the active window.
Updates
01 April 2003: Small bug fix in the OnMouseUp handler.
11 January 2003: Patrick Vanden Driessche updated both the C# and VB.NET versions:
The popup now doesn't close automatically when the mouse is still over it
The popup is shown again when it was disappearing and the mouse comes over it
A few other bugs have been corrected.
10 January 2003: A port of TaskbarNotifier has been done by Patrick Vanden Driessche in VB.NET
05 December 2002: The popup is now shown using the Win32 function ShowWindow(SW_SHOWNOACTIVATE), to prevent the popup from stealing the focus.
Conclusion
I hope this code will be useful to you. If you have suggestions to enhance this class functionalities, please post a comment.
As i mentioned as the subject title ,and could i add some button in the pop up windows??how to do that ??i am new to c# ,help !i will appreciate your help! ;P
no body replied !!!!!! ok ,i already fix it up by myself ,another question,how to make a lot of message in the right corner according to the sequence of the time ?????please ,somebody help me !!!
Hi, I am using VB.NET 2008 [comming from vb 6, this is a big jump], when I open the project [downloaded one] it converted it to vb.net 2008. I get an error message stating that "Resource file 'TaskBarNotifier.resx' can't not be found". I am sorry if I sound dumm but what is a resx file? Should there be one? There isn't one for TaskBarNotifier.vb but there is one for Form1.vb.
I ran into the same problem. To correct it I clicked on the form name in solution explorer and removed the resource file under it. I also did this for form1. Once done, I rebuilt the project and ran it. Worked great after that.
I am currently prototyping a UI and want to make use of this popup window. I need to extend it and modify the inheritance (will inherit from DevExpress derivative of WinForm) to improve the applications look and feel. Your code is the only that I have found that extends WinForm and looks like it can be modified. Your code did not have any license information contained in it, is it alright to use it in commercial code?
I can send you my email address if you want to take this discussion out of the message board.
You shouldn't dispose the grfx object: one of those things that will probably result in undefined behaviour. Rule of the thumb with the .Net framework is that you shouldn't dispose something if the BCLs handed it to you. For example the .Net framework may actually be doing the following:
... using(Graphics g = Graphics.FromImage(tmpImage)) { PaintEventArgs pve = new PaintEventArgs(g); targetForm.OnPaintBackground(pve); g.Save(); // If OnPaintBackground was disposed an ObjectDisposedException will be thrown here. } ...
Hi, I think u need call TaskbarNotifier Close() method since is it Form and Dispose timer when ur TaskbarNotifier become not visible. It is no memory leak problem, after I done above way.
This applies to .Net 1.1 and is general advice which relates to the usage of this notifier and as such requires no modification of the original source.
I needed to wait 5 seconds after an event occurred before showing the notifier dialog. If you use a standard timer it's call back will execute on a different thread (not the UI thread), this thread will draw the notifier but the user will be unable to click on it.
When you instantiate the delay timer you must set the SynchronisationObject to your main UI form. This will ensure that the callback event is fired on the UI thread.
Hi, I used your code (and parts of the contribution from Crusty Applesniffer) in a freeware application that monitors xPL messages traffic (xPL is used in home automation projects). You can find it here: http://blog.boxedbits.com/xpl#xplballoon[^] Thank you for making your excellent code available! Tom