NotifyIcon class: display an icon for an application in the notification area : NotifyIcon « GUI « VB.Net Tutorial

Home
VB.Net Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statements
5.Date Time
6.Class Module
7.Development
8.Collections
9.Generics
10.Attributes
11.Event
12.LINQ
13.Stream File
14.GUI
15.GUI Applications
16.Windows Presentation Foundation
17.2D Graphics
18.I18N Internationlization
19.Reflection
20.Regular Expressions
21.Security
22.Socket Network
23.Thread
24.Windows
25.XML
26.Database ADO.net
27.Design Patterns
VB.Net
VB.Net by API
VB.Net Tutorial » GUI » NotifyIcon 
14.48.1.NotifyIcon class: display an icon for an application in the notification area
Imports System
Imports System.Drawing
Imports System.Windows.Forms

Public NotInheritable Class Form1
    Inherits System.Windows.Forms.Form

    Private contextMenu1 As System.Windows.Forms.ContextMenu
    Friend WithEvents menuItem1 As System.Windows.Forms.MenuItem
    Friend WithEvents notifyIcon1 As System.Windows.Forms.NotifyIcon
    Private components As System.ComponentModel.IContainer

    <System.STAThread()> _
    Public Shared Sub Main()
        System.Windows.Forms.Application.Run(New Form1)
    End Sub 'Main

    Public Sub New()
        Me.components = New System.ComponentModel.Container
        Me.contextMenu1 = New System.Windows.Forms.ContextMenu
        Me.menuItem1 = New System.Windows.Forms.MenuItem

        Me.contextMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem(){Me.menuItem1})

        Me.menuItem1.Index = 0
        Me.menuItem1.Text = "E&xit"

        Me.ClientSize = New System.Drawing.Size(292266)
        Me.Text = "Notify Icon Example"

        Me.notifyIcon1 = New System.Windows.Forms.NotifyIcon(Me.components)

        notifyIcon1.Icon = New Icon("appicon.ico")

        notifyIcon1.ContextMenu = Me.contextMenu1

        notifyIcon1.Text = "Form1 (NotifyIcon example)"
        notifyIcon1.Visible = True
    End Sub 'New

    Private Sub notifyIcon1_DoubleClick(Sender as object, e as EventArgshandles notifyIcon1.DoubleClick
        if (me.WindowState = FormWindowState.Minimizedthen _
            me.WindowState = FormWindowState.Normal
        me.Activate()
    end sub

    Private Sub menuItem1_Click(Sender as object, e as EventArgshandles menuItem1.Click
        me.Close()
    end sub

End Class
14.48.NotifyIcon
14.48.1.NotifyIcon class: display an icon for an application in the notification area
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.