Appunti di Programmazione

Form con sfondo colorato e sfumato

Per chi volesse una form con sfondo colorato e sfumato...

Form con sfondo colorato e sfumato

Imports System.Drawing.Drawing2D

Public Class Form1

    Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) _
    Handles MyBase.Paint

        Dim colore1 As Color = Color.OrangeRed
        Dim colore2 As Color = Color.Yellow

        Dim gradient_brush As New LinearGradientBrush(New Point(0, 0), New Point(Me.Width, 0), colore1, colore2)

        e.Graphics.FillRectangle(gradient_brush, 0, 0, Me.Width, Me.Height)

    End Sub

    Private Sub Form1_SizeChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.SizeChanged

        Me.Invalidate()

    End Sub

End Class