Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows.Forms
public class FillFillRectangles
public Shared Sub Main
Application.Run(New Form1)
End Sub
End class
public class Form1
Inherits System.Windows.Forms.Form
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
Dim g As Graphics = e.Graphics
Dim blueBrush As New SolidBrush(Color.Green)
Dim redBrush As New SolidBrush(Color.Green)
Dim rect As New Rectangle(10, 20, 50, 50)
Dim rectArray As RectangleF() = {New RectangleF(0.0F, 0.0F, 60.0F, 60.0F), New RectangleF(100.0F, 100.0F, 150.0F, 60.0F), New RectangleF(200.0F, 80.0F, 230.0F, 100.0F), New RectangleF(40.0F, 32.0F, 20.0F, 200.0F)}
g.FillRectangle(New HatchBrush(HatchStyle.BackwardDiagonal, Color.Yellow, Color.Black), rect)
e.Graphics.FillRectangles(redBrush, rectArray)
End Sub
Public Sub New()
MyBase.New()
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 273)
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
End Sub
End Class
|