1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
public delegate void PbClickHandler(object sender, EventArgs args);
public class Piece
{
private PictureBox pb = new PictureBox();
public event PbClickHandler PbClicked;
public Piece()
{
pb.Click += new EventHandler(pb_Click);
}
private void pb_Click(object sender, EventArgs e)
{
this.OnPbClicked(e);
}
protected virtual void OnPbClicked(EventArgs args)
{
this.PbClicked(this, args);
}
}
public class Case : Panel
{
private Piece _Piece = new Piece();
public Case()
{
this._Piece.PbClicked += new PbClickHandler(_Piece_PbClicked);
}
private void _Piece_PbClicked(object sender, EventArgs args)
{
}
} |
Partager