填充形狀
Graphics.FillShapes 繪製一個形狀並用給定的顏色填充它。填充形狀可以使用
-
Brush
工具 - 用純色填充形狀Dim rect As New Rectangle(50, 50, 50, 50) e.Graphics.FillRectangle(Brushes.Green, rect) 'draws a rectangle that is filled with green e.Graphics.FillPie(Brushes.Silver, rect, 0, 180) 'draws a half circle that is filled with silver
-
HatchBrush
工具 - 用圖案填充形狀
Dim hBrush As New HatchBrush(HatchStyle.ZigZag, Color.SkyBlue, Color.Gray)
'creates a HatchBrush Tool with a background color of blue, foreground color of gray,
'and will fill with a zigzag pattern
Dim rectan As New Rectangle(100, 100, 100, 100)
e.Graphics.FillRectangle(hBrush, rectan)
-
LinearGradientBrush
- 用漸變填充形狀Dim lBrush As New LinearGradientBrush(point1, point2, Color.MediumVioletRed, Color.PaleGreen) Dim rect As New Rectangle(50, 50, 200, 200) e.Graphics.FillRectangle(lBrush, rect)
-
TextureBrush
- 用圖片填充形狀
你可以從資源,已定義的點陣圖或檔名中選擇圖片
Dim textBrush As New TextureBrush(New Bitmap("C:\ColorPic.jpg"))
Dim rect As New Rectangle(400, 400, 100, 100)
e.Graphics.FillPie(textBrush, rect, 0, 360)
Hatch Brush Tool
和 LinearGradientBrush
都匯入以下語句: Imports System.Drawing.Drawing2D