우선,

1. Resource에 원하는 이미지를 등록한다.

2. Button에 원하는 이미지를 올린다.

3. 마우스 이벤트를 사용한다.

3.1 picLotIdScan_MouseHover => Mouse가 button위로 올라갔을때.

picLotIdScan_MouseLeave => Mouse가 button위에 없을때.

 

각 생성 함수부는 하기와 같다.

 

// 마우스 Over

private void picLotIdScan_MouseHover(object sender, EventArgs e)
{

// button or picture ctrol명.Image에 리소스 이미지를 바로 넣으면 된다.
this.picLotIdScan.Image = Properties.Resources.Over_LotIdScan;
}

// 마우스 Leave

private void picLotIdScan_MouseLeave(object sender, EventArgs e)
{
this.picLotIdScan.Image = Properties.Resources.LotIdScan;
}

 

* 추가로 Form1에서 Form2 호출하는 방법.

private void picLotIdScan_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2();

f2.ShowDialog();
}

 

 

+ Recent posts