Tooltip bug

Résolu
agarcia_01 Messages postés 51 Date d'inscription mardi 8 février 2005 Statut Membre Dernière intervention 25 août 2006 - 6 mars 2006 à 12:43
agarcia_01 Messages postés 51 Date d'inscription mardi 8 février 2005 Statut Membre Dernière intervention 25 août 2006 - 7 mars 2006 à 11:13
Bonjour,





Je developpe une interface graphique en C# qui possede une icone style messenger dans la tray bar.





Lorsque je lance mon application et je passe ma souris sur un label, textbox, mon tooltip s'affiche parfaitement.


Je click sur l'icone pour faire disparraitre cette form en mettant
showintaskBarfalse; et WindowState FormWindowState.Minimized;

et ensuite je la reaffiche en cliquant dessus et la lorsque je repasse
ma souris sur le label mon tooltip de se reaffiche plus.





Mon code pour le minimize de ma fenetre







private void notifyicon_Click(object sender, EventArgs e) {







         if(!maxiMini){



            WindowState = FormWindowState.Minimized; 



            ShowInTaskbar=false;



            maxiMini=true;



         }else {



            WindowState = FormWindowState.Normal; 



            ShowInTaskbar=true;



            Focus();



            maxiMini=false;}







      }





Est ce un bug connu de .net ?


Pourquoi les controles ne detect plus le onmouseover lorsque l'on passe la form en mode minimized ?





ci-dessous une simple le code de ma form avec mon tooltip merci d'avance






using System;

using System.Drawing;

using System.Collections;

using System.ComponentModel;

using System.Windows.Forms;

using System.Data;

using System.Resources;



namespace ToolTipBug

{

    /// <summary>

    /// Description r&#233;sum&#233;e de Form1.

    /// </summary>

    public class Form1 : System.Windows.Forms.Form

    {

        private System.Windows.Forms.Label label1;

        private System.ComponentModel.IContainer components;



        public static ResourceManager
resources= new ResourceManager("ToolTipBug.icon",
System.Reflection.Assembly.GetCallingAssembly());

        private NotifyIcon notifyicon;

        private ToolTip mytooltip;

        private bool maxiMini=false;    





        public Form1()

        {

            

            Init();

        

        }





        protected override void Dispose( bool disposing )

        {

            if( disposing )

            {

                if (components != null) 

                {

                    components.Dispose();

                }

            }

            base.Dispose( disposing );

        }



        #region Code g&#233;n&#233;r&#233; par le Concepteur Windows Form

        

        private void Init()

        {

            components = new System.ComponentModel.Container();

            label1 = new System.Windows.Forms.Label();

            notifyicon = new System.Windows.Forms.NotifyIcon(components);

            notifyicon.Icon=(Icon)resources.GetObject("Internet");

            mytooltip = new System.Windows.Forms.ToolTip(components);

            SuspendLayout();

            // 

            // label1

            // 

            label1.Location = new System.Drawing.Point(24, 40);

            label1.Name = "label1";

            label1.Size = new System.Drawing.Size(368, 23);

            label1.TabIndex = 0;

            label1.Text =
"Passer la souris sur ce label  pour faire apparaitre le Tooltip";

           
mytooltip.SetToolTip(label1, "Voila mon tool tip cliquez sur l\'icone
ronde bleu dans le Tray dans la zone pour " +

           
    "faire disparaitre la fen&#234;tre et recliquer dessus
vous verrez la Tooltip de s&#146;aff" +

                "ichera plus :=( ");

            label1.Click += new System.EventHandler(label1_Click);

            // 

            // notifyicon

            // 

            notifyicon.Text = "";

            notifyicon.Visible = true;

            notifyicon.Click += new System.EventHandler(notifyicon_Click);

            // 

            // mytooltip

            // 

            mytooltip.ShowAlways = true;

            // 

            // Form1

            // 

            AutoScaleBaseSize = new System.Drawing.Size(5, 13);

            ClientSize = new System.Drawing.Size(440, 266);

            Controls.Add(label1);

            Name = "Form1";

            Text = "Form1";

            Load += new System.EventHandler(Form1_Load);

            ResumeLayout(false);



        }

        #endregion



        [STAThread]

        static void Main() 

        {

            Application.Run(new Form1());

        }



        private void Form1_Load(object sender, System.EventArgs e) {

        

        }

    

        private void notifyicon_Click(object sender, EventArgs e) {



            if(!maxiMini){

                WindowState = FormWindowState.Minimized; 

                ShowInTaskbar=false;

                maxiMini=true;

            }else {

                WindowState = FormWindowState.Normal; 

                ShowInTaskbar=true;

                Focus();

                maxiMini=false;}



        }

    

    }

}

2 réponses

Cristobal72 Messages postés 2 Date d'inscription mercredi 23 novembre 2005 Statut Membre Dernière intervention 8 mars 2006
6 mars 2006 à 18:49
Le seul moyen que j'ai trouvé est de modifier la propriété ShowAlways à chaque fois.



if(this.WindowState == FormWindowState.Normal)
{
this.WindowState = FormWindowState.Minimized;
this.ShowInTaskbar = false; //le pb
mytooltip.ShowAlways=false;
}
else
{
this.WindowState = FormWindowState.Normal;
this.ShowInTaskbar = true;
mytooltip.ShowAlways=true;
}
3
agarcia_01 Messages postés 51 Date d'inscription mardi 8 février 2005 Statut Membre Dernière intervention 25 août 2006
7 mars 2006 à 11:13
Effectivement mon tooltip reapparait !!

C'est assez contraignant je trouve ... c'est dommage que dans le
construteur meme si l'on meme cette propriété a true ça ne marche pas.



Merci !!!
0
Rejoignez-nous