2011-03-21 2 views

답변

6

도움 바랍니다. 정말 감사합니다,

Public Module EntryPoint 
    Public Sub Main() 
     Dim ctx As New AppContext() 
     Application.Run(ctx) 
    End Sub 
End Module 
+0

크리스 : 당신은 NotifyIcon를 인스턴스화하고 양식을 작성하지 않고 그것을 사용할 수 있습니다

Public Class AppContext Inherits ApplicationContext Private notifyIcon As NotifyIcon Private appActive As Boolean Public Sub New() AddHandler Application.ApplicationExit, AddressOf OnApplicationExit notifyIcon = New NotifyIcon() notifyIcon.Icon = My.Resources.ActiveIcon notifyIcon.Text = "The app is active." AddHandler notifyIcon.MouseClick, AddressOf OnIconMouseClick appActive = True notifyIcon.Visible = True End Sub Private Sub OnApplicationExit(ByVal sender As Object, ByVal e As EventArgs) If notifyIcon IsNot Nothing Then notifyIcon.Dispose() End If End Sub Private Sub OnIconMouseClick(ByVal sender As Object, ByVal e As MouseEventArgs) If e.Button = MouseButtons.Left Then appActive = Not appActive notifyIcon.Icon = If(appActive, My.Resources.ActiveIcon, My.Resources.InactiveIcon) notifyIcon.Text = If(appActive, "The app is active.", "The app is not active.") Else If MsgBox("Do you want to Exit?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then notifyIcon.Visible = False ExitThread() End If End If End Sub End Class 

을 그리고 하위 홈페이지에서 응용 프로그램을 시작합니다. 이것은 내가 찾고 있었던 바로 그 것이다. 이것은 매우 효과적이었고 내가 가지고 있었던 몇 가지 다른 문제를 해결했습니다. 고맙습니다! – avword

0

그냥

그리고 폼로드 이벤트에

이렇게 .. 투명 양식을 넣어 .. 1 × 1에 를 크기를 조정 그리고 notifyicon를 추가 당신이 원하는 것을 만들 수 있습니다 ..

PS : 컨텍스트 메뉴 스트립을 만들 수 있습니다 (오른쪽 클릭시 A 메뉴). 당신이 만든에 ..

는 양식이 꼭 필요한 것은 당신 ..

관련 문제