You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
1.7 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Delegate
{
class Program
{
static InterC area;
static EventDelegate form;
static void Main(string[] args)
{
//Basic basic = new Basic();
//basic.Test();
//InterA clsA = new InterA();
//clsA.DoWork();
//int[] arr = new int[] { 5, 53, 3, 6, 8, 43, 64, 33, 12 };
//InterB.CompareDelegate compDelegate = AscendingCompare;
//InterB.Sort(arr, compDelegate);
//compDelegate = DescendingCompare;
//InterB.Sort(arr, compDelegate);
//area = new InterC();
//area.MyClick += Area_Click;
//area.MyClick += After_Click;
//area.ShowDialog();
form = new EventDelegate();
form.MyClick += Area_Click;
form.MyClick += After_Click;
//form.MyClick(this); // 클래스 외부에서 사용할 수 없음
form.ShowDialog();
}
static int AscendingCompare(int i1, int i2)
{
if (i1 == i2)
return 0;
return i2 > i1 ? 1 : -1;
}
static int DescendingCompare(int i1, int i2)
{
if (i1 == i2)
return 0;
return i2 < i1 ? 1 : -1;
}
static void Area_Click(object sender)
{
Form form = sender as Form;
form.Text = "MyArea 클릭!";
}
static void After_Click(object sender)
{
Form form = sender as Form;
form.Text += " AfterClick 클릭!";
}
}
}