Solved

How can i show a form oval shape at runtime

Posted on 2000-02-25
2
309 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

910 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now