Error con notifyIcon c#

Iniciado por Hartigan, 10 Septiembre 2010, 18:58 PM

0 Miembros y 1 Visitante están viendo este tema.

Hartigan

Hola, pues he creado un notifyIcon para mi agenda para poder minimizarla, pero me salen varios errores.

el primero de ellos es que al restaurar la aplicación una de las barras de herramientas se queda en gris.

y el otro problema es que después de restaurar la aplicación al intentar cerrarla me da un erro de desbordamiento de pila.

Os muestro de lo que os hablo:






Mis funciones para minimizar a la bandeja son:

Código (csharp) [Seleccionar]


private void notifyIcon1_DoubleClick(object sender, EventArgs e)
       {
           this.Show();
           this.WindowState = FormWindowState.Normal;
           this.notifyIcon1.Visible = false;
       }

       private void Interfaz_MenuPrincipal_Resize(object sender, EventArgs e)
       {
           if (this.WindowState == FormWindowState.Minimized)
           {
               //Ocultamos el formulario
               this.Visible = false;
               //Hacemos visible el icono de la bandeja del sistema
               notifyIcon1.Visible = true;
           }

       }


gracias de antemano.

[D4N93R]

en el notifyIcon1_DoubleClick deberia ser:
Código (csharp) [Seleccionar]
if (this.WindowState == FormWindowState.Minimized)
    this.WindowState = FormWindowState.Normal;
this.Activate();

Hartigan

Me sigue dando los mismos errores....

[D4N93R]

Podrïas postear el stackTrace...

Hartigan

Cita de: [D4N93R] en 10 Septiembre 2010, 20:55 PM
Podrïas postear el stackTrace...

Excepción no controlada del tipo 'System.StackOverflowException' en System.Windows.Forms.dll

es lo único que me dice....


[D4N93R]

Está entrando en un loop infinito y por eso te da el error. posiblemente sea por  private void Interfaz_MenuPrincipal_Resize(object sender, EventArgs e), que se llama por ponerse invisible si no estoy equivocado. Intenta con otro evento a ver..

Hartigan

Nada no hay manera, me sigue dando el mismo error...

.mokk.

#7
Intenta asi
Código (vb.net) [Seleccionar]
   Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
       If Me.WindowState = FormWindowState.Minimized Then
           Me.Visible = False
           NotifyIcon1.Visible = True
       End If
   End Sub

   Private Sub NotifyIcon1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles NotifyIcon1.DoubleClick
       Me.Visible = True
       Me.WindowState = FormWindowState.Normal
       Me.Show()
       NotifyIcon1.Visible = False
   End Sub


Ami me funciono

Fallos
visible = true - jamas lo pusistes
Me.WindowState = FormWindowState.Normal - se pone antes del show asi antes de mostrarse ya estara normal si lo pones despues se mostrara y vera que sigue minimizado y dara otra vez y nose mostrara nunca

Hartigan

Cita de: .mokk. en 11 Septiembre 2010, 03:26 AM
Intenta asi
Código (vb.net) [Seleccionar]
   Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
       If Me.WindowState = FormWindowState.Minimized Then
           Me.Visible = False
           NotifyIcon1.Visible = True
       End If
   End Sub

   Private Sub NotifyIcon1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles NotifyIcon1.DoubleClick
       Me.Visible = True
       Me.WindowState = FormWindowState.Normal
       Me.Show()
       NotifyIcon1.Visible = False
   End Sub


Ami me funciono

Fallos
visible = true - jamas lo pusistes
Me.WindowState = FormWindowState.Normal - se pone antes del show asi antes de mostrarse ya estara normal si lo pones despues se mostrara y vera que sigue minimizado y dara otra vez y nose mostrara nunca

sí, ya he probado de esa manera y tampoco, me sigue dando error de desbordamiento en el close del form y no se porqué....

43H4FH44H45H4CH49H56H45H

A mi me daba problemas cuando no especificaba el boton del mouse, prueba asi:

Código (csharp) [Seleccionar]
if (e.Button == MouseButtons.Left){
//code
}

-R IP
:0100
-A 100 
2826:0100 MOV AH,09
2826:0102 MOV DX,109
2826:0105 INT 21
2826:0105 MOV AH,08
2826:0105 INT 21
2826:0107 INT 20
2826:0109 DB 'MI NICK ES CODELIVE.$' 
2826:0127 
-R BX
:0000
-R CX
:20
-N CODELIVE.COM
-W