Export (0) Print
Expand All

Shape.SuspendPaint Method

Suspends the painting logic for a shape.

Namespace:  Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

public void SuspendPaint()

The SuspendPaint and ResumePaint methods are used in tandem to suppress multiple Paint events when you are adjusting multiple attributes of a shape. For example, you would typically call the SuspendPaint method, set the Size, Location, BorderColor, or BorderStyle properties of the shape, and then call the ResumePaint method to enable the changes to take effect.

The following example demonstrates how to use the SuspendPaint and ResumePaint methods for an OvalShape control. This example requires that you have an OvalShape control named OvalShape1 on a form.

private void ovalShape1_Click(System.Object sender, System.EventArgs e)
    // Suspend painting.
    // Set some properties.
    ovalShape1.BackStyle = BackStyle.Opaque;
    ovalShape1.BackColor = Color.Blue;
    ovalShape1.FillStyle = FillStyle.Plaid;
    ovalShape1.FillColor = Color.Red;
    // Resume painting and execute any pending requests.

© 2014 Microsoft