Solved

Uneven Forms

Posted on 1998-11-14
4
158 Views
Last Modified: 2010-04-30
hey, I guess u guys have seen the mp3 player Sonique... the version I have is beta .55 ... Anyway, I wuz just wondering,... how can you make an unevenly shaped form in VB5 (round... protruding, oval etc... )

thanx
0
Comment
Question by:lamer
  • 2
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
trillo earned 50 total points
ID: 1444916
Hi.
I haven't seen the Sonique mp3 player but I guess I know what you're asking for.
You have to use the SetWindowRgn function to change the shape of your Form to any other shape.
Of course, you should pass a handle to a region to this function.... so must first create the region or shape. You can do this by calling any of the Region fuctions provided by the Windows API. This way, you can combine, intersect, end make other operations to simple regions to create complex regions (or shapes).

This is a sample code for what you need. I'll use an elliptic Region.
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 Command1_Click()
    Unload Me
End Sub

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

Private Sub Picture1_Click()
    Label1.Caption = "Picture clicked"
End Sub

I hope this can help you.
0
 

Author Comment

by:lamer
ID: 1444917
thanx.. I'll try to get back to ya soon
0
 
LVL 2

Expert Comment

by:trillo
ID: 1444918
OK
0
 

Author Comment

by:lamer
ID: 1444919
excellent dude!

Well, it'll be a pain to sychronize the backround picture with the form...
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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 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…

730 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