본문 바로가기

   
Programming/Winform

ImageList, MenuStrip(니모닉, 단축키), ContextMenu

반응형

컨트롤에 이미지 넣기

//이미지리스트

// - 하나 이상의 이미지를 리스트화 시킨 컨트롤(이미지집합)

// - 이미지리스트를 사용하는 컨트롤과 연계해서 사용
 



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 MenuStrip : Form

       {

             public MenuStrip()

             {

                    InitializeComponent();

             }

 

             private void 첫번째ToolStripMenuItem_Click(object sender, EventArgs e)

             {

                    MessageBox.Show("하나");

             }

 

             private void 두번째ToolStripMenuItem_Click(object sender, EventArgs e)

             {

                    MessageBox.Show("");

             }

 

             private void 세번째ToolStripMenuItem_Click(object sender, EventArgs e)

             {

                    MessageBox.Show("");

             }

 

             private void 빨강ToolStripMenuItem_Click(object sender, EventArgs e)

             {

 

             }

 

             private void 파랑ToolStripMenuItem_Click(object sender, EventArgs e)

             {

 

             }

 

             private void 노랑ToolStripMenuItem_Click(object sender, EventArgs e)

             {

 

             }

 

             private void 빨강ToolStripMenuItem1_Click(object sender, EventArgs e)

             {

                    this.BackColor = Color.Red;

                    Test();

                    빨강ToolStripMenuItem1.Checked = true;

             }

 

             private void Test()

             {

                    빨강ToolStripMenuItem1.Checked = false;

                    파랑ToolStripMenuItem1.Checked = false;

                    노랑ToolStripMenuItem1.Checked = false;

             }

 

             private void 파랑ToolStripMenuItem1_Click(object sender, EventArgs e)

             {

                    this.BackColor = Color.Blue;

                    Test();

                    파랑ToolStripMenuItem1.Checked = true;

             }

 

             private void 노랑ToolStripMenuItem1_Click(object sender, EventArgs e)

             {

                    this.BackColor = Color.Yellow;

                    Test();

                    노랑ToolStripMenuItem1.Checked = true;

             }

 

             private void button1_Click(object sender, EventArgs e)

             {

                    MessageBox.Show("마우스클릭");

             }

       }

}

 

 

 

반응형