Solved

How can i show a form oval shape at runtime

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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 …
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

791 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