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.
 
 
 
 
 
 

47 lines
1.2 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace ShenTun.Camera.AForgeL
{
public class Photo : AForge.Controls.PictureBox
{
public string PhotoId { get; set; }
private bool _Selected;
public bool Selected
{
get { return _Selected; }
set
{
_Selected = value;
this.BorderStyle = _Selected ? BorderStyle.Fixed3D : BorderStyle.None;
}
}
#region 委托事件
public delegate void SelectedPhoto(string photoId);
public event SelectedPhoto SelecPhotoInfo;
#endregion
public Photo():base()
{
SetStyle(ControlStyles.DoubleBuffer, true);
Selected = false;
if (string.IsNullOrEmpty(PhotoId)) PhotoId = Guid.NewGuid().ToString();
SizeMode = PictureBoxSizeMode.StretchImage;
Click+=Photo_Click;
}
private void Photo_Click(object sender, EventArgs e)
{
Selected = !Selected;
SelecPhotoInfo(this.PhotoId);
this.Refresh();
}
}
}