共用方式為


Shape.SuspendPaint 方法

暫停圖形的繪製邏輯。

命名空間:  Microsoft.VisualBasic.PowerPacks
組件:  Microsoft.VisualBasic.PowerPacks.Vs (在 Microsoft.VisualBasic.PowerPacks.Vs.dll 中)

語法

'宣告
Public Sub SuspendPaint
public void SuspendPaint()
public:
void SuspendPaint()
member SuspendPaint : unit -> unit
public function SuspendPaint()

備註

SuspendPaint和ResumePaint方法可用於使用串聯方式隱藏多個Paint時您正在調整圖形的多個屬性的事件。 例如,您通常會呼叫SuspendPaint方法,設定SizeLocationBorderColor,或BorderStyle的圖形,然後呼叫屬性ResumePaint方法,讓變更生效。

範例

下列範例示範如何使用SuspendPaint和ResumePaint方法OvalShape控制項。 此範例中您需要OvalShape名 OvalShape1 為表單上的控制項。

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 安全性

請參閱

參考

Shape 類別

Microsoft.VisualBasic.PowerPacks 命名空間

其他資源

如何:使用 LineShape 控制項繪製線條 (Visual Studio)

如何:使用 OvalShape 和 RectangleShape 控制項繪製圖案 (Visual Studio)

Line 和 Shape 控制項簡介 (Visual Studio)