GEGAmbato
asked on
How to copy Clip of an Image to Clipboard C# Code in a WPF Application
This is the Code the Works in Window Forms Application (Non-WPF)
"TiffImage" is a picturebox Control
public Bitmap ImageClip;
pivate void CopyBlock()
{
Point topLeft = new Point(Math.Min(pointStart. X, pointEnd.X), Math.Min(pointStart.Y, pointEnd.Y));
int clipWidth = Math.Abs(pointEnd.X - pointStart.X + 1),
clipHeight = Math.Abs(pointEnd.Y - pointStart.Y + 1);
ImageClip = new Bitmap(clipWidth, clipHeight);
Graphics Gra = Graphics.FromImage(ImageCl ip);
Gra.DrawImage(TiffImage.Im age, new Rectangle(0, 0, clipWidth, clipHeight),
topLeft.X, topLeft.Y, clipWidth, clipHeight, GraphicsUnit.Pixel);
Gra.Dispose();
Clipboard.SetDataObject(Im ageClip);
}
What is the Code to do this in WFP Application
"TiffImage" is a picturebox Control
public Bitmap ImageClip;
pivate void CopyBlock()
{
Point topLeft = new Point(Math.Min(pointStart.
int clipWidth = Math.Abs(pointEnd.X - pointStart.X + 1),
clipHeight = Math.Abs(pointEnd.Y - pointStart.Y + 1);
ImageClip = new Bitmap(clipWidth, clipHeight);
Graphics Gra = Graphics.FromImage(ImageCl
Gra.DrawImage(TiffImage.Im
topLeft.X, topLeft.Y, clipWidth, clipHeight, GraphicsUnit.Pixel);
Gra.Dispose();
Clipboard.SetDataObject(Im
}
What is the Code to do this in WFP Application
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.