In my application i want to drawing a rectangle on image box using bitmap called myBitmap. and the problem is how to use System.Drawing.bitMap as source for image in C# Wpf .
private void MyRectangle(System.Drawing.Point p1, System.Drawing.Point p2)
{
int var1,var2;
var1 = Convert.ToInt16(image1.Width);
var2 = Convert.ToInt16(image1.Height);
System.Drawing.Bitmap myBitmap = new System.Drawing.Bitmap(var1,var2);
using (Graphics g = Graphics.FromImage(myBitmap))
{
g.Clear(Color.LightBlue);
g.DrawRectangle(new Pen(Brushes.Red),p1.X, p1.Y, p2.X - p1.X, p2.Y - p1.Y);
}
// this.image1.Source = myBitmap;
}