Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Display problem/bug

Display problem/bug

Scheduled Pinned Locked Moved C#
helpdatabasediscussion
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    eynkram
    wrote on last edited by
    #1

    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

    M S A 3 Replies Last reply
    0
    • E eynkram

      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

      M Offline
      M Offline
      mav northwind
      wrote on last edited by
      #2

      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

      E 1 Reply Last reply
      0
      • M mav northwind

        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

        E Offline
        E Offline
        eynkram
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • E eynkram

          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

          S Offline
          S Offline
          Skynyrd
          wrote on last edited by
          #4

          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})

          E 1 Reply Last reply
          0
          • S Skynyrd

            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})

            E Offline
            E Offline
            eynkram
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            • E eynkram

              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

              A Offline
              A Offline
              ACorbs
              wrote on last edited by
              #6

              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();

              E 1 Reply Last reply
              0
              • A ACorbs

                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();

                E Offline
                E Offline
                eynkram
                wrote on last edited by
                #7

                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

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups