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()
void SuspendPaint()
member SuspendPaint : unit -> unit
Public Sub 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.
Private Sub OvalShape1_Click() Handles OvalShape1.Click
    ' Suspend painting.
    ' Set some properties.
    OvalShape1.BackStyle = PowerPacks.BackStyle.Opaque
    OvalShape1.BackColor = Color.Blue
    OvalShape1.FillStyle = PowerPacks.FillStyle.Plaid
    OvalShape1.FillColor = Color.Red
    ' Resume painting and execute any pending requests.
End Sub

See Also

Shape Class
Microsoft.VisualBasic.PowerPacks Namespace
How to: Draw Lines with the LineShape Control (Visual Studio)
How to: Draw Shapes with the OvalShape and RectangleShape Controls (Visual Studio)
Introduction to the Line and Shape Controls (Visual Studio)

Return to top