Display problem/bug
-
Hi All, This ones a stumper.... The thread gets started that loops indefinately. It checks a database for a new message and displays it in the taskbar popup window. In the thread class i created there is a block of code initializing the popup window. When you call the show function: taskbarNotifier1.Show("Chatter",what,500,5000,200); You get a small line on top of the taskbar. If I change the code to this.. taskbarNotifier1.Show("Chatter",what,500,5000,200); MessageBox.Show(what); The popup window shows as long as the messagebox is open. When I close the messagebox the popup disapears. This is very strange almost bug like. Does anyone have any suggestions or thoughts on this.. Please help!!! Thanks, Mark
-
Hi All, This ones a stumper.... The thread gets started that loops indefinately. It checks a database for a new message and displays it in the taskbar popup window. In the thread class i created there is a block of code initializing the popup window. When you call the show function: taskbarNotifier1.Show("Chatter",what,500,5000,200); You get a small line on top of the taskbar. If I change the code to this.. taskbarNotifier1.Show("Chatter",what,500,5000,200); MessageBox.Show(what); The popup window shows as long as the messagebox is open. When I close the messagebox the popup disapears. This is very strange almost bug like. Does anyone have any suggestions or thoughts on this.. Please help!!! Thanks, Mark
What's this TaskBarNotifier you're writing about? It seems to be the component causing troubles but without further information (code!) we won't be able to help you. mav
-
What's this TaskBarNotifier you're writing about? It seems to be the component causing troubles but without further information (code!) we won't be able to help you. mav
Hi Mav, The TaskBarNotifier is as follows. The code works fine in a non-thread environment. Thanks alot for your time!!! I have a main routine create a thread that polls a sql server and calls the show method in the following code snip. When you call the show method it displays a small line above the taskbar. If you add a messageBox.show() right after you call the taskbarnotifier.show() it works fine. I got the taskbar notification code from an article on this site. // C# TaskbarNotifier Class v1.0 // by John O'Byrne - 02 december 2002 // 01 april 2003 : Small fix in the OnMouseUp handler // 11 january 2003 : Patrick Vanden Driessche added a few enhancements // Small Enhancements/Bugfix // Small bugfix: When Content text measures larger than the corresponding ContentRectangle // the focus rectangle was not correctly drawn. This has been solved. // Added KeepVisibleOnMouseOver // Added ReShowOnMouseOver // Added If the Title or Content are too long to fit in the corresponding Rectangles, // the text is truncateed and the ellipses are appended (StringTrimming). using System; using System.Drawing; using System.Drawing.Imaging; using System.Drawing.Drawing2D; using System.Windows.Forms; using System.Runtime.InteropServices; namespace CustomUIControls { /// /// TaskbarNotifier allows to display MSN style/Skinned instant messaging popups /// public class TaskbarNotifier : System.Windows.Forms.Form { #region TaskbarNotifier Protected Members protected Bitmap BackgroundBitmap = null; protected Bitmap CloseBitmap = null; protected Point CloseBitmapLocation; protected Size CloseBitmapSize; protected Rectangle RealTitleRectangle; protected Rectangle RealContentRectangle; protected Rectangle WorkAreaRectangle; protected Timer timer = new Timer(); protected TaskbarStates taskbarState = TaskbarStates.hidden; protected string titleText; protected string contentText; protected Color normalTitleColor = Color.FromArgb(255,0,0); protected Color hoverTitleColor = Color.FromArgb(255,0,0); protected Color normalContentColor = Color.FromArgb(0,0,0); protected Color hoverContentColor = Color.FromArgb(0,0,0x66); protected Font normalTitleFont = new Font("Arial",12,FontStyle.Regular,GraphicsUnit.Pixel); protected Font hoverTitleFont = new Font("Arial",12,FontStyle.Bold,GraphicsUnit.Pixel); protecte
-
Hi All, This ones a stumper.... The thread gets started that loops indefinately. It checks a database for a new message and displays it in the taskbar popup window. In the thread class i created there is a block of code initializing the popup window. When you call the show function: taskbarNotifier1.Show("Chatter",what,500,5000,200); You get a small line on top of the taskbar. If I change the code to this.. taskbarNotifier1.Show("Chatter",what,500,5000,200); MessageBox.Show(what); The popup window shows as long as the messagebox is open. When I close the messagebox the popup disapears. This is very strange almost bug like. Does anyone have any suggestions or thoughts on this.. Please help!!! Thanks, Mark
-
If ur calling the Show method of ur TaskBarNotifier in a different thread to the one where the control was created u have to use Invoke.
taskbarNotifier1.Invoke(new myShowDelegate(taskbarNotifier.Show),new object[] ({"Chatter",what,500,5000,200})
Hi Skynyrd, Thanks for you time on this. I tried creating a delegate and using the Invoke method and the same thing happends. The way the code works is as follows: Main App---> thread -->taskbarNotification.show() Main app creates a thread that loops checking the server for new messages. When there is a new message the thread calls the taskbarNotification1.Invoke... This is when the line appears at the bottom of my screen. The line looks like a border and is the same width as the bitmap background specified for the popup window. Like I said previously if I call MessageBox.Show("anything") after I call the taskbarNotification1.Invoke the program works perfectly with an annoying messagebox every time. Thanks again for your time!!! Mark
-
Hi All, This ones a stumper.... The thread gets started that loops indefinately. It checks a database for a new message and displays it in the taskbar popup window. In the thread class i created there is a block of code initializing the popup window. When you call the show function: taskbarNotifier1.Show("Chatter",what,500,5000,200); You get a small line on top of the taskbar. If I change the code to this.. taskbarNotifier1.Show("Chatter",what,500,5000,200); MessageBox.Show(what); The popup window shows as long as the messagebox is open. When I close the messagebox the popup disapears. This is very strange almost bug like. Does anyone have any suggestions or thoughts on this.. Please help!!! Thanks, Mark
Well, after a lot of testing trying to duplicate your error… I think I found your problem. Any normal class belongs to the thread that new(ed) it. However, form and control classes are a different story because they are not actually initialized until they are used, thus the show function takes part… I repeated your error by initializing (Constructor) the taskbarNotifier in one thread and then invoking the show function. When I used the constructor on the interface thread and invoked the Show function from another thread, the problem disappeared. So move
taskbarNotifier1 = new taskbarNotifier();
-
Well, after a lot of testing trying to duplicate your error… I think I found your problem. Any normal class belongs to the thread that new(ed) it. However, form and control classes are a different story because they are not actually initialized until they are used, thus the show function takes part… I repeated your error by initializing (Constructor) the taskbarNotifier in one thread and then invoking the show function. When I used the constructor on the interface thread and invoked the Show function from another thread, the problem disappeared. So move
taskbarNotifier1 = new taskbarNotifier();
Hi ACorbs, That was it.. I had the taskbarNotifier1 instance of the TaskbarNotifier() constructor created in the Thread1() of my new thread. I moved the taskbarNotifier1 and as you said the problem went away. Awesome!!!! Thanks!!!! Time to move on..... Thanks alot ACorbs,Skynard and Mav for your kind help!!!! Mark