코드 및 디자이너는 아래와 같습니다.. 디자이너에서 트레이 아이콘 설정을 해주면 완료!
using System.Windows.Forms;
namespace WindowsFormsApp1
{
public partial class Tray : Form
{
public Tray()
{
InitializeComponent();
this.ShowInTaskbar = false; //하단 테스트바에서 보이지 않도록 설정
this.Visible = false; //화면에 보이지 않도록 설정
this.WindowState = FormWindowState.Minimized; //최소화
this.Opacity = 0; //투명하게 하여 타이틀도 안보이게 설정
this.FormBorderStyle = FormBorderStyle.FixedToolWindow; //Alt + Tab 에서도 보이지 않도록
//this.종료ToolStripMenuItem.Click += new System.EventHandler(this.종료ToolStripMenuItem_Click);
}
private void 종료ToolStripMenuItem_Click(object sender, System.EventArgs e)
{
Close();
}
}
}
notifyIcon 및 contextMenuStrip 을 설정해줍니다.
'C# > Windows Form' 카테고리의 다른 글
[C# Window Forms] App.config, appsettings.json 파일 값 저장 (0) | 2025.06.25 |
---|---|
[C# Windows Form] 32bit 프로그램 메모리 사용량 늘리기 (editbin.exe) (0) | 2025.05.29 |
[C# Windows Form] Form 앞에 다른 Form 을 항상 윗쪽에 위치 시키기 (Owner, + WPF 위에 Form 고정) (0) | 2025.04.11 |
[C# Windows Form] NamedPipe 통신 예제 (IPC) (0) | 2024.11.30 |
[C# Windows Form] 섬네일 현재 영역만 그려주기 (Scroll, Thumbnail) (0) | 2024.11.08 |