Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

thiagobillieri

Tray Icon

Recommended Posts

Eu preciso que o meu programa nao mostre o form principal, que quando eu inicie ele vá direto pra tray e nao mostre nada.

Segue o código que eu tenho, caso isso ajude

 

Friend WithEvents Tray As System.Windows.Forms.NotifyIcon	Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem	Friend WithEvents CMenu As System.Windows.Forms.ContextMenu	Friend WithEvents MenuItem2 As System.Windows.Forms.MenuItem	<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()		Me.components = New System.ComponentModel.Container		Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))		Me.Tray = New System.Windows.Forms.NotifyIcon(Me.components)		Me.CMenu = New System.Windows.Forms.ContextMenu		Me.MenuItem2 = New System.Windows.Forms.MenuItem		'		'Tray		'		Me.Tray.ContextMenu = Me.CMenu		Me.Tray.Icon = CType(resources.GetObject("Tray.Icon"), System.Drawing.Icon)		Me.Tray.Text = "Tray"		Me.Tray.Visible = True		'		'CMenu		'		Me.CMenu.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem2})		'		'MenuItem2		'		Me.MenuItem2.Index = 0		Me.MenuItem2.Text = "Exit"		'		'Form1		'		Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)		Me.ClientSize = New System.Drawing.Size(292, 273)		Me.Name = "Form1"	End Sub

--

Abraços

 

Thiago.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Após pesquisas consegui fazer o que eu queria.

Aqui está o códio caso alguém queira.

 

Imports System.NetImports System.Web.MailImports System.DiagnosticsPublic Class frmPrincipal	Inherits System.Windows.Forms.Form#Region " Windows Form Designer generated code "	Public Sub New()		MyBase.New()		InitializeComponent()	End Sub	Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)		If disposing Then			If Not (components Is Nothing) Then				components.Dispose()			End If		End If		MyBase.Dispose(disposing)	End Sub	Private components As System.ComponentModel.IContainer	Friend WithEvents Tray As System.Windows.Forms.NotifyIcon	Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem	Friend WithEvents CMenu As System.Windows.Forms.ContextMenu	<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()		Me.components = New System.ComponentModel.Container		Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmPrincipal))		Me.Tray = New System.Windows.Forms.NotifyIcon(Me.components)		Me.CMenu = New System.Windows.Forms.ContextMenu		Me.MenuItem1 = New System.Windows.Forms.MenuItem		'		'Tray		'		Me.Tray.ContextMenu = Me.CMenu		Me.Tray.Icon = CType(resources.GetObject("Tray.Icon"), System.Drawing.Icon)		Me.Tray.Text = "Bot"		Me.Tray.Visible = True		'		'CMenu		'		Me.CMenu.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem1})		'		'MenuItem1		'		Me.MenuItem1.Index = 0		Me.MenuItem1.Text = "Exit"		'		'frmPrincipal		'		Me.AccessibleRole = System.Windows.Forms.AccessibleRole.None		Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)		Me.ClientSize = New System.Drawing.Size(168, 136)		Me.ControlBox = False		Me.Enabled = False		Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None		Me.MaximizeBox = False		Me.MinimizeBox = False		Me.Name = "frmPrincipal"		Me.Opacity = 0		Me.ShowInTaskbar = False		Me.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide		Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual	End Sub#End Region	'Fechar Programa	Private Sub MenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem1.Click		Me.Close()	End SubEnd Class

Não é necessário fazer os imports, são de outras funções do meu aplicativo.

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.