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 39 40 41
|
Bitmap Pic1Resize;
int PicDragIndex = 0;
private void pic1_MouseEnter(object sender, EventArgs e)
{
toolTip1.SetToolTip(pic1, "test tooltip pic1");
}
private void pic1_MouseDown(object sender, MouseEventArgs e)
{
isDragging = true;
}
private void pic1_MouseMove(object sender, MouseEventArgs e)
{
if ((e.Button == MouseButtons.Left) && (Pic1Resize != null))
{
pic1.DoDragDrop(Pic1Resize, DragDropEffects.Copy);
}
PicDragIndex = 1;
}
private void pic1_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.Bitmap))
e.Effect = DragDropEffects.Copy;
else
e.Effect = DragDropEffects.None;
}
private void pic1_DragDrop(object sender, DragEventArgs e)
{
if (isDragging)
{
if ((e.Data.GetDataPresent(DataFormats.Bitmap)))
this.pic1.Image = (Bitmap)(e.Data.GetData(DataFormats.Bitmap));
Pic1Resize = (Bitmap)(e.Data.GetData(DataFormats.Bitmap));
BitmapDrag(); // reload du nouveau Bitmap dans le Bitmap source.
((PictureBox)this.panel1.Controls["pic" + PicDragIndex.ToString()]).Image = PicDrag; // reload de la nouvelle image dans la vignette source dans la vignette destination
}
isDragging = false;
} |