NotifyIcon restoring acting weird

J. Scott Elblein

Well-known member
Joined
Dec 14, 2006
Messages
166
Location
Chicago
Programming Experience
10+
Hi all

I am using this code to minimize/Restore to/from tray:

VB.NET:
    Private Sub frmMain_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
        If Me.WindowState = FormWindowState.Minimized Then
            NotifyIcon1.Visible = True
            Me.Hide()
        End If
    End Sub


VB.NET:
    Public Sub RestoreWindow()

        ' Set the WindowState to normal if the form is minimized to the tray.
        frmMain.Show()
        If frmMain.WindowState = FormWindowState.Minimized Then
            frmMain.WindowState = FormWindowState.Normal
        End If

        frmMain.NotifyIcon1.Visible = False

    End Sub

My problem is, every time I restore, the form's height gets a little smaller. I'm perplexed. Any ideas?

Thanks
 
Do you have any code in the Activate event or even the Shown event? based on the code posted, it doesn't explain why a resize of the form is happening
 
ok, so what form does this code reside in?
VB.NET:
Public Sub RestoreWindow()

        ' Set the WindowState to normal if the form is minimized to the tray.
        frmMain.Show()
        If frmMain.WindowState = FormWindowState.Minimized Then
            frmMain.WindowState = FormWindowState.Normal
        End If

        frmMain.NotifyIcon1.Visible = False

    End Sub
 
I just placed a timer on the form, that writes to the console window the height and width (in that order), and minimized/restored a few times. Here is the log:


647 773 <-original size
25 160 <- Minimized to tray
587 813 <-restored once
467 893 <-restored again after a few Minimizes and restores
 
I discovered the problem. I am using Skincrafter skinning engine in my app, and apparently there is a bug in it that causes this. I removed the skinning and the code works fine.

Now the problem is, skincrafter.com has been down for quite awhile. :(
 
Back
Top