CodeItBetter Programming Another VB Programming Blog

How to create rounded Form

Posted on September 4, 2009

Sometimes we may need to create a form little differently like rounded form. Here is the way to set your form as rounded:

Instructions:

  • Create a new Project
  • Add a new Form to it and name it as Form1
  • Add a new command button to it and name it as Command1
  • Add a new Module to it and name it as Module1

Now, add the following code to Module1:

1
2
3
4
Option Explicit
 
Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long

Add the following code to Form1:

1
2
3
4
5
6
7
8
9
Option Explicit
 
Private Sub Command1_Click()
  Unload Me
End Sub
 
Private Sub Form_Load()
  SetWindowRgn hWnd, CreateEllipticRgn(0, 0, 300, 200), True
End Sub

Related posts:

  1. How to create fancy oval forms
  2. How to create circular forms
  3. How to create Circular Controls
  4. How to show your form in different way
  5. How to Confine a Form to another Form
  6. How to Create a Menu completely at Runtime
  7. How to create a splash screen.
  8. How to draw Rounded PolyGon
  9. How to Make Controls and Forms with your own Custom Shape
  10. How to create a email link in your form

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


Trackbacks are disabled.