“Draw a line on a bmp image which is pass into a method using drawline method in C#”
PaintEventArgs e would suggest that you are doing this during the “paint” event for an object. Since you are calling this in a method, then no you do not need to add PaintEventArgs e anywhere.
To do this in a method, use @BFree’s answer.
public void DrawLineInt(Bitmap bmp)
{
Pen blackPen = new Pen(Color.Black, 3);
int x1 = 100;
int y1 = 100;
int x2 = 500;
int y2 = 100;
// Draw line to screen.
using(var graphics = Graphics.FromImage(bmp))
{
graphics.DrawLine(blackPen, x1, y1, x2, y2);
}
}
The “Paint” event is raised when the object is redrawn. For more information see:
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.paint.aspx