It is easier to draw a line on an image than to draw a frame. Linear control is implemented by setting the pen.
/** // <Summary>
/// Draw a line on the Image
/// </Summary>
/// <Param name = "BMP"> original graph </param>
/// <Param name = "P0"> start point </param>
/// <Param name = "p1"> termination point </param>
/// <Param name = "rectcolor"> line color </param>
/// <Param name = "linewidth"> line width </param>
/// <Param name = "ds"> line style </param>
/// <Returns> output chart </returns>
Public static bitmap drawlineinpicture (bitmap BMP, point P0, Point P1, color linecolor, int linewidth, dashstyle DS)
...{
If (BMP = NULL) return NULL;
If (then x = p1.x | then Y = p1.y) return BMP;
Graphics G = graphics. fromimage (BMP );
Brush = new solidbrush (linecolor );
Pen = new pen (brush, linewidth );
// Pen. Alignment = penalignment. inset;
Pen. dashstyle = Ds;
G. drawline (pen, P0, P1 );
G. Dispose ();
Return BMP;
}