I have a picture box in wpf.
code is ..
<DockPanel Height="237">
<WindowsFormsHost Height="237">
<wf:PictureBox x:Name="LiveImage" MouseDown="LiveImage_MouseDown"/>
</WindowsFormsHost>
</DockPanel>
private void LiveImage_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (IsCropFrame)
{
try
{
CropPicture = new PictureBox();
CropPicture.CreateControl();
CropPicture.Width = 132;
CropPicture.Height = 170;
CropPicture.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
cropPen = new System.Drawing.Pen(System.Drawing.Color.Blue, 1);
LiveImage.CreateGraphics().DrawRectangle(cropPen, cropX, cropY, 132, 170);
IsCropFrame = false;
CropPicture.MouseDown += new System.Windows.Forms.MouseEventHandler(CropPicture_MouseDown);
CropPicture.MouseMove += new System.Windows.Forms.MouseEventHandler(CropPicture_MouseMove);
CropPicture.MouseUp += new System.Windows.Forms.MouseEventHandler(CropPicture_MouseUp);
}
catch (Exception ex)
{
}
}
else
{
}
}>
private void CropPicture_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
dragging = true;
dragPoint = new System.Drawing.Point(e.X, e.Y);
}
private void CropPicture_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (dragging)
CropPicture.Location = new System.Drawing.Point(CropPicture.Location.X + e.X - dragPoint.X, CropPicture.Location.Y + e.Y - dragPoint.Y);
}
private void CropPicture_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
dragging = false;
}
None of mouse events of CropPicture box is occurred.
Now I want to drag a CropPicture box in another place of LiveImage picture box.