Jak wywołać funkcję za pomocą argumnt PaintEventArgs?

Biorąc pod uwagę następujący przykład kodu z MSDN:

private void GetPixel_Example(PaintEventArgs e)
    {

        // Create a Bitmap object from an image file.
        Bitmap myBitmap = new Bitmap(@"C:\Users\tanyalebershtein\Desktop\Sample Pictures\Tulips.jpg");

        // Get the color of a pixel within myBitmap.
        Color pixelColor = myBitmap.GetPixel(50, 50);

        // Fill a rectangle with pixelColor.
        SolidBrush pixelBrush = new SolidBrush(pixelColor);
        e.Graphics.FillRectangle(pixelBrush, 0, 0, 100, 100);
    }

Jak można zadzwonić doPaint funkcjonować?

questionAnswers(3)

yourAnswerToTheQuestion