Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Start Windows Form-App hidden, only Notifyicon

Posted on 2007-04-01
5
Medium Priority
?
619 Views
Last Modified: 2008-02-01
Hello

How can I start a windows form-application hidden, so that only a notifyicon is visible?
The form should be started...

Thanks
0
Comment
Question by:Ruttensoft
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 18833606
Here is a VB.Net 2003 version.

Click on Project --> "Add Existing Item..." and then change the "File name:" to "*.Ico" so you can select an Icon for your Tray Icon.  Once an Icon has been added to your project, select and then in the Properties for it, change the "Build Action" to "Embedded Resource".

You need to change "face04.ico" to the name of the icon you added to your project.

Obviously all this app does is have an "Exit" option.  You can either add more menus or trap the left click event on the NotifyIcon to show a form...

Module Module1

    Public Sub Main()
        Application.Run(New MyAppContext)
    End Sub

    Private Class MyAppContext
        Inherits ApplicationContext

        Private ni As New NotifyIcon
        Private cm As New ContextMenu
        Private mi As New MenuItem("Exit")

        Public Sub New()
            cm.MenuItems.Add(mi)
            ni.Icon = New Icon(Me.GetType, "face04.ico")
            ni.ContextMenu = cm
            ni.Visible = True
            AddHandler mi.Click, AddressOf Me.mi_Click
        End Sub

        Private Sub mi_Click(ByVal sender As Object, ByVal e As System.EventArgs)
            ni.Visible = False
            Application.ExitThread()
        End Sub

    End Class

End Module
0
 

Author Comment

by:Ruttensoft
ID: 18833677
Hi Idle_Mind

I think that this is for only Tray-Icon, without any form. But I'm searching a way to load a Form, but not showing it. So when I click on it, it should set the form.visible to true and bring it it front...

I can do that all, but not load the form without showing it, cause after form_load it is showing itself always...
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 2000 total points
ID: 18833833
To show a form invisibly...set the Opacity() property at DESIGN-TIME to 0 (zero).

Then when you want it to show at RUN-TIME set the Opacity() property to 1.
0
 

Author Comment

by:Ruttensoft
ID: 18833835
Ah Thanks, I did exactly that, but I took 100 instead of 1... :-)
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 18833843
Yeah...that's inconsistent eh?

Design-Time = 0 --> 100
Run-Time = 0 --> 1
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question