Ecco un esempio di ciò che intendo.
Questa è una classe costruita al volo relativa ad un Form che illustra quanto ho descritto:
Il resto (funzioni più complesse) vien da sè!codice:Imports System.Collections Imports System.Drawing Public Class MainForm Private RectangleList As New ArrayList Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs) MyBase.OnPaint(e) For Each R As Rectangle In RectangleList e.Graphics.DrawRectangle(Pens.DarkBlue, R) Next End Sub Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs) MyBase.OnMouseDown(e) Dim R As New Rectangle R.X = e.X R.Y = e.Y R.Height = 100 R.Width = 200 RectangleList.Add(R) Me.Invalidate() End Sub End Class
Ciao!![]()

Rispondi quotando