1. MSDN
Visual C# 기본 바로 가기 키
cf) Visual C# 기본 바로 가기 키
2. Visual C# keybinding pdf 파일
Visual Studio 2008 버전
cfile28.uf.15204B3450AEC2341DBAF7.pdf
// 이벤트 정의
public delegate void EventHandler(object sender, EventArgs e);
public partial class form2 : Form
{
// 이벤트 선언
public event EventHandlerHandler eReceiveMsg;
public form2()
{
InitialzeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
// 이벤트 호출
eReceiveMsg(this, e);
}
}
Form frm2 = new Form2(this);
frm2.eReceiveMsg += new EventHandler(OnReceiveMsg);
frm2.Show();
private void OnReceiveMsg(object sender, EventArgs e)
{
SetMsgTextBox("JJ");
}
public void SetMsgTextBox(string strSetText)
{
MessageBox.Show(strSetText);
}
form1 에서 form2 의 객체를 참조 시키고| 지정자 event 델리게이트 이름; |
using System;
namespace EventTest
{
// 이벤트 형식 선언
// - 델리게이트는 클래스와 같은 레벨에 선언
public delegate void Notice();
class Printer
{
public void Print()
{
Console.WriteLine("수신된 데이터를 인쇄합니다.");
}
}
class Receiver
{
// 이벤트 선언
public event Notice OnComplete;
public void Receive()
{
for (int i = 0; i < 100; i++)
{
Console.WriteLine(i + "% 수신중");
System.Threading.Thread.Sleep(200);
}
if (OnComplete != null)
OnComplete();
}
}
class CSTest
{
public static void Main()
{
Printer P = new Printer();
Receiver R = new Receiver();
R.OnComplete += P.Print;
R.Receive();
}
}