日期:2014-05-17 浏览次数:21141 次
public class ImagePixel
{
public ImagePixel(Image DefaultImage, Rectangle Normal, Rectangle Move, Rectangle Drop, PictureBox pbContainer)
{
Image NormalImage;
Image MoveImage;
Image DropImage;
Bitmap map = new Bitmap(DefaultImage);
NormalImage = map.Clone(Normal, System.Drawing.Imaging.PixelFormat.Format64bppPArgb);
MoveImage = map.Clone(Move, System.Drawing.Imaging.PixelFormat.Format64bppPArgb);
DropImage = map.Clone(Drop, System.Drawing.Imaging.PixelFormat.Format64bppPArgb);
pbContainer.Image = NormalImage;
pbContainer.MouseMove += delegate
{
pbContainer.Image = MoveImage;
};
pbContainer.MouseLeave += delegate
{
pbContainer.Image = NormalImage;
};
pbContainer.MouseDown += delegate
{
pbContainer.Image = DropImage;
};
}
}
ImagePixel ip_1 = new ImagePixel(TempApp.Properties.Resources.SetBtn, new Rectangle(0, 0, 33, 19), new Rectangle(33, 0, 33, 19), new Rectangle(66, 0, 33, 19), pb_1);