Solved

How can i show a form oval shape at runtime

Posted on 2000-02-25
2
315 Views
Last Modified: 2006-11-17
How can i show a form oval shape at runtime
0
Comment
Question by:itacan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

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 …
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month6 days, 11 hours left to enroll

634 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