본문 바로가기

   
Programming/Winform

ToolStrip, NotifyIcon, StatusBar

반응형

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

 

namespace Test

{

       public partial class NotifyIcon : Form

       {

             public NotifyIcon()

             {

                    InitializeComponent();

             }

 

             private void 종료ToolStripMenuItem_Click(object sender, EventArgs e)

             {

                    Application.Exit();

             }

 

             private void 아이콘감추기ToolStripMenuItem_Click(object sender, EventArgs e)

             {

                    notifyIcon1.Visible = false;

             }

 

             private void 아이콘보이기ToolStripMenuItem_Click(object sender, EventArgs e)

             {

                    notifyIcon1.Visible = true;

             }

 

             private void 창최소화AToolStripMenuItem_Click(object sender, EventArgs e)

             {

                    this.Hide();

                    notifyIcon1.Visible = true;

             }

 

             private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)

             {

                    this.Show();

                    notifyIcon1.Visible = false;

             }

 

             private void 창보이기ToolStripMenuItem_Click(object sender, EventArgs e)

             {

                    this.Show();

                    notifyIcon1.Visible = false;

              }

 

             private void 종료ToolStripMenuItem1_Click(object sender, EventArgs e)

             {

                    Application.Exit();

             }

       }

}

 

 여러개의 스테이스바가 있다면 

컨텍스트 메뉴 , 툴바, 상태바는 프로그램의 기본 골격을 이루고 버튼을 올리고 텍스트 버튼을 올리고 작업을 한다


using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

 

namespace Start

{

       public partial class StatusBar : Form

       {

             public StatusBar()

             {

                    InitializeComponent();

             }

 

             private void button1_Click(object sender, EventArgs e)

             {

                    statusStrip1.Text = "첫번째입니다.";

             }

 

             private void button2_Click(object sender, EventArgs e)

             {

                    toolStripStatusLabel1.Text = "두번째입니다.";

                    toolStripStatusLabel2.Text = DateTime.Now.ToLongDateString();

             }

 

             private void StatusBar_Load(object sender, EventArgs e)

             {

                    //ToolTip : 풍선 도움말

                    //현재 폼에 있는 모든 컨트롤의 풍선 도움말을 관리

                    //프로그램 제작이 완성될쯤 한번 작성~

                    toolTip1.SetToolTip(button1, "실패한 예제");

                    toolTip1.SetToolTip(button2, "성공한 예제");

             }

       }

}

 

 

반응형