Skip to content

Instantly share code, notes, and snippets.

@facebookegypt
Last active December 14, 2015 01:19
Show Gist options
  • Save facebookegypt/9e3dc4c2a0d257a6341b to your computer and use it in GitHub Desktop.
Save facebookegypt/9e3dc4c2a0d257a6341b to your computer and use it in GitHub Desktop.
Option Explicit
Private Declare Function SetWindowRgn Lib "user32" (ByVal hwnd As Long, _
ByVal hRgn As Long, _
ByVal bRedraw As Boolean) As Long
Private Declare Function CreateEllipticRgn Lib "gdi32" (ByVal X1 As Long, _
ByVal Y1 As Long, _
ByVal X2 As Long, _
ByVal Y2 As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Dim X As Single
Dim Y As Single
Private Sub Form_Load()
Dim RGN As Long
With Me
.Width = Val(310 * 15)
.Height = Val(310 * 15)
.Left = (Screen.Width - .Width) / 2
.Top = (Screen.Height - .Height) / 2
.Picture = LoadPicture(App.Path & "/analog clock1.JPG")
.BackColor = vbWhite
X = .Width / 2
Y = .Height / 2
End With
'Make a round shaped form...
RGN = CreateEllipticRgn(0, 0, 310, 310)
Call SetWindowRgn(Me.hwnd, RGN, True)
Call DeleteObject(RGN)
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment