Imports System.Windows.Forms Imports System.Drawing Module Module1 Public Sub main() Application.Run(New MainForm()) End Sub End Module Class MainForm Inherits Form Dim pb As CustomPictureBox Public Sub New() pb = New CustomPictureBox() pb.Dock = DockStyle.Fill Me.Controls.Add(pb) pb.RectList.Add(New PaintEventHandler(AddressOf DrawBackGround)) pb.RectList.Add(New PaintEventHandler(AddressOf drawBlackRect)) pb.RectList.Insert(1, New PaintEventHandler(AddressOf drawRedRect)) End Sub Sub DrawBackGround(ByVal sender As Object, ByVal e As PaintEventArgs) e.Graphics.FillRectangle(Brushes.White, e.ClipRectangle) End Sub Sub drawBlackRect(ByVal sender As Object, ByVal e As PaintEventArgs) e.Graphics.FillRectangle(Brushes.Black, New RectangleF(10, 10, 100, 100)) End Sub Sub drawRedRect(ByVal sender As Object, ByVal e As PaintEventArgs) e.Graphics.FillRectangle(Brushes.Red, New RectangleF(20, 20, 100, 100)) End Sub End Class Class CustomPictureBox Inherits PictureBox Public RectList As New List(Of PaintEventHandler) Sub CustomPictureBox_Paint(ByVal sender As Object, ByVal e As PaintEventArgs) Handles Me.Paint For Each method As PaintEventHandler In rectList method(sender, e) Next End Sub End Class