VB.NET Code:

Imports System

Public Class frmSplForm

    Inherits System.Windows.Forms.Form

    Private mouseOffset As Point

    Private isMouseDown As Boolean = False

    Private oTheme As Theme

    Private selectedBit As Boolean = False

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

        Try

            If cmbTheme.SelectedItem = "Theme1" And selectedBit = True Then

                'Get the Image Location

                Dim p_w_picpathFile As Image = Image.FromFile(oTheme.BackGroundImage)

 

                Dim shape As New System.Drawing.Drawing2D.GraphicsPath

                'Create the Ellipse shape

                shape.AddEllipse(0, 0, p_w_picpathFile.Width, p_w_picpathFile.Height)

                'Clip the Shape to the form region

                Me.Region = New System.Drawing.Region(shape)

                'Draw p_w_picpath to screen.

                e.Graphics.DrawImage(p_w_picpathFile, New PointF(0.0F, 0.0F))

 

            ElseIf cmbTheme.SelectedItem = "Theme2" And selectedBit = True Then

                'Get the Image Location

                Dim p_w_picpathFile As Image = Image.FromFile(oTheme.BackGroundImage)

 

                Dim shape As New System.Drawing.Drawing2D.GraphicsPath

                Dim rect As New Rectangle(0, 0, p_w_picpathFile.Width + 100, p_w_picpathFile.Height + 100)

                'Create the Arc shape

                shape.StartFigure()

                shape.AddArc(rect, 0, 280)

                shape.CloseFigure()

 

                Dim myArray As Point() = {New Point(30, 200), New Point(200, 100), _

New Point(370, 200), New Point(300, 400), New Point(100, 400)}

                ' Create a GraphicsPath object and add a polygon.

                Dim myPath As New System.Drawing.Drawing2D.GraphicsPath

                myPath.AddPolygon(myArray)

 

                'Clip the Shape to the form region

                Me.Region = New System.Drawing.Region(shape)

 

                'Draw p_w_picpath to screen.

                e.Graphics.DrawImage(p_w_picpathFile, New PointF(0.0F, 0.0F))

            End If

 

            selectedBit = False

        Catch ex As Exception

            MessageBox.Show(ex.Message)

        End Try

    End Sub

 

    Private Sub frmSplForm_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove

        'Code for moving the form when dragged with mouse

        If isMouseDown Then

            Dim mousePos As Point = Control.MousePosition

            mousePos.Offset(mouseOffset.X, mouseOffset.Y)

            Me.Location = mousePos

        End If

    End Sub

 

    Private Sub frmSplForm_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseUp

        ' Changes the isMouseDown field so that the form does

        ' not move unless the user is pressing the left mouse button.

        If e.Button = MouseButtons.Left Then

            isMouseDown = False

        End If

 

    End Sub

 

    Private Sub frmSplForm_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown

        Dim xOffset As Integer

        Dim yOffset As Integer

 

        If e.Button = MouseButtons.Left Then

            xOffset = -e.X - SystemInformation.FrameBorderSize.Width

            yOffset = -e.Y - SystemInformation.CaptionHeight - _

                    SystemInformation.FrameBorderSize.Height

            mouseOffset = New Point(xOffset, yOffset)

            isMouseDown = True

        End If

    End Sub

 

    Private Sub butDestroy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butDestroy.Click

        Me.Dispose()

        Application.Exit()

    End Sub

 

    Private Sub butOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butOK.Click

        If cmbTheme.SelectedItem = "Theme1" Then

            oTheme = New Theme1

            oTheme.SetTheme(Me)

            selectedBit = True

        ElseIf cmbTheme.SelectedItem = "Theme2" Then

            oTheme = New Theme2

            oTheme.SetTheme(Me)

            selectedBit = True

        End If

        Me.ResizeRedraw = True

        Me.Refresh()

    End Sub

End Class

 

----------------- Theme class --------------------------

Public MustInherit Class Theme

    Private sFrmBackGroundImage As String

    Private sFrmTransperncyColor As Color

 

    Public Property BackGroundImage()

        Get

            Return sFrmBackGroundImage

        End Get

        Set(ByVal Value)

            sFrmBackGroundImage = Value

        End Set

    End Property

 

    Public Property TransperncyColor()

        Get

            Return sFrmTransperncyColor

        End Get

        Set(ByVal Value)

            sFrmTransperncyColor = Value

        End Set

    End Property

 

    Public MustOverride Function SetTheme(ByRef frmObj As Form) As Boolean

End Class

 

Public Class Theme1

    Inherits Theme

    Sub New()

        'Get the Image Location

        Dim fn As String = System.Environment.CurrentDirectory() & "\" & "Bitmap1.JPG"

        Me.BackGroundImage = fn

        Me.TransperncyColor = Color.FromArgb(192, 192, 255)

    End Sub
 

 

    Public Overrides Function SetTheme(ByRef frmObj As System.Windows.Forms.Form) As Boolean

        'set the transparency color

        frmObj.TransparencyKey = Me.TransperncyColor

        'set the form background p_w_picpath

        frmObj.BackgroundImage.FromFile(Me.BackGroundImage)

        'Change the control settings

        Dim cntl As Control

        For Each cntl In frmObj.Controls

            If TypeOf (cntl) Is Label Then

                cntl.ForeColor = Color.Yellow

                cntl.BackColor = Color.Blue

            ElseIf TypeOf (cntl) Is ComboBox Then

                cntl.ForeColor = Color.Blue

            Else

                cntl.ForeColor = Color.Black

            End If

        Next

    End Function

 

End Class

 

Public Class Theme2

    Inherits Theme

    Sub New()

        'Get the Image Location

        Dim fn As String = System.Environment.CurrentDirectory() & "\" & "Bitmap2.JPG"

        Me.BackGroundImage = fn

        Me.TransperncyColor = Color.FromArgb(192, 192, 255)

    End Sub

 

    Public Overrides Function SetTheme(ByRef frmObj As System.Windows.Forms.Form) As Boolean

        'set the transparency color

        frmObj.TransparencyKey = Me.TransperncyColor

        'set the form background p_w_picpath

        frmObj.BackgroundImage.FromFile(Me.BackGroundImage)

        'Change the control settings

        Dim cntl As Control

        For Each cntl In frmObj.Controls

            If TypeOf (cntl) Is Label Then

                cntl.ForeColor = Color.Green

                cntl.BackColor = Color.Gold

            ElseIf TypeOf (cntl) Is ComboBox Then

                cntl.ForeColor = Color.DarkRed

            Else

                cntl.ForeColor = Color.DarkGreen

            End If

        Next

    End Function

 

End Class