如何在鼠标单击事件中调用具有系统参数的方法:
public void DrawStringRectangleF(PaintEventArgs e)
{
// Create string to draw.
String drawString = "Sample Text";
// Create font and brush.
Font drawFont = new Font("Arial", 16);
SolidBrush drawBrush = new SolidBrush(Color.Black);
// Create rectangle for drawing.
float x = 150.0F;
float y = 150.0F;
float width = 200.0F;
float height = 50.0F;
RectangleF drawRect = new RectangleF(x, y, width, height);
// Draw rectangle to screen.
Pen blackPen = new Pen(Color.Black);
e.Graphics.DrawRectangle(blackPen, x, y, width, height);
// Draw string to screen.
e.Graphics.DrawString(drawString, drawFont, drawBrush, drawRect);
}
我想在这个事件中调用这个方法:
private void button1_Click(object sender, EventArgs e)
{
// calling DrawStringRectangleF(PaintEventArgs e) here
}
如果参数是变量,调用这些方法的时候只要提一下值就可以很容易地调用方法,但是这种情况下怎么调用呢?!