Solved

Uneven Forms

Posted on 1998-11-14
4
151 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
Comment Utility
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
Comment Utility
thanx.. I'll try to get back to ya soon
0
 
LVL 2

Expert Comment

by:trillo
Comment Utility
OK
0
 

Author Comment

by:lamer
Comment Utility
excellent dude!

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

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

743 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

15 Experts available now in Live!

Get 1:1 Help Now