A
A
Andrey Zagorodniy2018-08-07 14:06:03
C++ / C#
Andrey Zagorodniy, 2018-08-07 14:06:03

How to call a function with PaintEventArgument e?

Here is the code:
private void Form1_Load(object sender, EventArgs e)
{
Draw();//trying to call this function
}
private void Draw(PaintEventArgs e) //want to draw an image on the form
{
Bitmap bitmap = new Bitmap("mankala_wood_board.png ");
e.Graphics.DrawImage(bitmap, 100, 50);
}
There is an error : There is no argument corresponding to the required formal parameter "e" from "Form1.Draw(PaintEventArgs)". What argument should be given?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Ark Tarusov, 2018-08-07
@kreo_OL

private void Form1_Load(object sender, EventArgs e)
{
Draw(e);//пытаюсь вызвать эту функцию
}

At least this one can)

L
LiptonOlolo, 2018-08-07
@LiptonOlolo

protected override void OnPaint(PaintEventArgs e)
{
  Draw(e);
  base.OnPaint(e);
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question