Circular Form in VB.NET


This piece of code changes the looks of a normal VB form. It executes two API calls and changes the shape of the rectangular form to a Circular form. This circular form can be used as a splash form where user gets a feel of the good looks of the software. You can modify the code to use it for various shapes and sizes. You can also restrict the user from using the ctrl+ spacebar to exit by using the borderstyle property. This code is a demonstration of the following two APIs, which are used in VB6.


On running this code a circular form appears. By right clicking on it you can exit the application.

API Description.

'The CreateEllipticRgn function creates an elliptical region
Public Shared Function <DllImport("gdi32")> _
CreateEllipticRgn(ByVal X1 As Integer, _
ByVal Y1 As Integer, _
ByVal X2 As Integer, _
ByVal Y2 As Integer) As Integer
'The SetWindowRgn function sets the window region of a window. The window 'region determines the area within the window where the system permits drawing. 'The system does not display any portion of a window that lies outside of the 'window region
Public Shared Function <DllImport("user32")> _
SetWindowRgn(ByVal hWnd As Integer, _
ByVal hRgn As Integer, _
ByVal bRedraw As Integer) As Integer


Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now