更新:2007 年 11 月
這個範例示範如何建立 SolidBrush 物件。
範例
System.Drawing.SolidBrush myBrush;
myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Black);
myBrush.Dispose();
編譯程式碼
這個範例需要:
- Windows Form 應用程式專案。
程式碼必須在 Form 類別的範圍之內。此表單的執行個體是以 this 所表示。
穩固程式設計
針對任何會消耗系統資源的物件 (例如 Brush 和 Graphics 物件),您應一律呼叫 Dispose。