Solved

Uneven Forms

Posted on 1998-11-14
4
153 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

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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 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…
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…

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

21 Experts available now in Live!

Get 1:1 Help Now