Solved

How can i show a form oval shape at runtime

Posted on 2000-02-25
2
311 Views
Last Modified: 2006-11-17
How can i show a form oval shape at runtime
0
Comment
Question by:itacan
2 Comments
 
LVL 10

Accepted Solution

by:
caraf_g earned 50 total points
ID: 2557874
From an answer previously given by Dalin:

Creating Win32 region windows
                       By AlMoataz B. Ahmed, AlMoataz_m@hotmail.com

                       The Win32 API includes a really amazing feature called
                       region windows. A window under Win32 no longer has to be
                       rectangular! In fact, it can be any shape that may be
                       constructed using Win32 region functions. Using the
                       SetWindowRgn Win32 function from within VB is so simple,
                       but the results are unbelievable. The following example
                       shows a VB form that is NOT rectangular. Enjoy!

                       ' This goes into the General Declarations section:
                         
                       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 SetWindowRgn Lib "user32" _
                       (ByVal hWnd As Long, ByVal hRgn As Long, _
                       ByVal bRedraw As Boolean) As Long
                         

                       Private Sub Form_Load()
                         Show 'The form!
                         SetWindowRgn hWnd, _
                         CreateEllipticRgn(0, 0, 300, 200), _
                         True
                       End Sub


0
 
LVL 13

Expert Comment

by:crazyman
ID: 2558623
'Make a New project. To the form Add a picture box And a Command button.

Option Explicit
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 SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Long) As Long

Private Sub Form_Load()
    Dim hr&, dl&
    Dim usew&, useh&
    usew& = Me.Width / Screen.TwipsPerPixelX
    useh& = Me.Height / Screen.TwipsPerPixelY
    hr& = CreateEllipticRgn(0, 0, usew, useh)
    dl& = SetWindowRgn(Me.hWnd, hr, True)
End Sub
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question