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
'宣告
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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
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)