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)

Syntax

'Declaração
Public Sub SuspendPaint
public void SuspendPaint()
public:
void SuspendPaint()
member SuspendPaint : unit -> unit 
public function SuspendPaint()

Remarks

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.

Examples

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 Sub OvalShape1_Click() Handles OvalShape1.Click
    ' Suspend painting.
    OvalShape1.SuspendPaint()
    ' 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.
    OvalShape1.ResumePaint(True)
End Sub
private void ovalShape1_Click(System.Object sender, System.EventArgs e)
{
    // Suspend painting.
    ovalShape1.SuspendPaint();
    // 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.
    ovalShape1.ResumePaint(true);
}

.NET Framework Security

See Also

Reference

Shape Class

Microsoft.VisualBasic.PowerPacks Namespace

Other Resources

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)