pkmalhotra2000
asked on
creating non-rectangular forms??
my question to EE is that can we create non rectangular form i.e. in shape of elipse, circle, free hand in VB6.0? if yes? then how please give me any type of help
my email id is pkmalhotra2000@rediffmail. com
my email id is pkmalhotra2000@rediffmail.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can do it by using CreateEllipticRgn and GetWindowRect/SetWindowRec t API functions. Here's a sample from VB2TheMax:
http://www.vb2themax.com/Item.asp?PageID=CodeBank&Cat=200&ID=175
http://www.vb2themax.com/Item.asp?PageID=CodeBank&Cat=200&ID=175
Rimvis has the answer I was going to suggest.
Thats about the best way to go about it.
David
Thats about the best way to go about it.
David
You can use the from transparancy API to set the form transparancy (set to 100%), hide the caption, draw any shape, then you can carve your form with your own style.
Private Declare Function GetWindowLong Lib "user32" Alias _
"GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias _
"SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" _
(ByVal hwnd As Long, ByVal crey As Byte, ByVal bAlpha As Byte, _
ByVal dwFlags As Long) As Long
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_LAYERED = &H80000
Private Const WS_EX_TRANSPARENT = &H20&
Private Const LWA_ALPHA = &H2&
Private Sub Form_Load()
Dim lOldStyle As Long
Dim bTrans As Byte ' The level of transparency (0 - 255)
bTrans = 255
lOldStyle = GetWindowLong(Me.hwnd, GWL_EXSTYLE)
SetWindowLong Me.hwnd, GWL_EXSTYLE, lOldStyle Or WS_EX_LAYERED
SetLayeredWindowAttributes Me.hwnd, 0, bTrans, LWA_ALPHA
End Sub
Private Declare Function GetWindowLong Lib "user32" Alias _
"GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias _
"SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes
(ByVal hwnd As Long, ByVal crey As Byte, ByVal bAlpha As Byte, _
ByVal dwFlags As Long) As Long
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_LAYERED = &H80000
Private Const WS_EX_TRANSPARENT = &H20&
Private Const LWA_ALPHA = &H2&
Private Sub Form_Load()
Dim lOldStyle As Long
Dim bTrans As Byte ' The level of transparency (0 - 255)
bTrans = 255
lOldStyle = GetWindowLong(Me.hwnd, GWL_EXSTYLE)
SetWindowLong Me.hwnd, GWL_EXSTYLE, lOldStyle Or WS_EX_LAYERED
SetLayeredWindowAttributes
End Sub
pk
You have several viable suggestions. Please evaluate them and select a answer or provide more informatiion or feedback.
mlmcc
You have several viable suggestions. Please evaluate them and select a answer or provide more informatiion or feedback.
mlmcc
I apologise for repeating(if so), but I didn't have the chance to read all the aforementioned techniques.
You can't make the actual form look like an elipse for instance. What you can do is make the form invisible and place inside the form labels and text boxes to make them look like the form shape you desire.
Please ask so if you need omre details.
You can't make the actual form look like an elipse for instance. What you can do is make the form invisible and place inside the form labels and text boxes to make them look like the form shape you desire.
Please ask so if you need omre details.
To dimlek:
> You can't make the actual form look like an elipse for instance.
Actualy, you CAN. Take a look at the sample I proposed.
To senohp:
I've copy/pasted yor code. It doesn't work :o/ I've created default VB project, changed form's border style to "None", and placed a shape on it. The form isn't transparent :o/ I'm using WinXP, BTW.
> You can't make the actual form look like an elipse for instance.
Actualy, you CAN. Take a look at the sample I proposed.
To senohp:
I've copy/pasted yor code. It doesn't work :o/ I've created default VB project, changed form's border style to "None", and placed a shape on it. The form isn't transparent :o/ I'm using WinXP, BTW.
sorry, bTrans is opaquicity instead of transparancy
bTrans=0 means transparant, bTrans=255 means opaque
bTrans=0 means transparant, bTrans=255 means opaque
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in Community Support that this question is:
- points to mlmcc
Please leave any comments here within the
next seven days.
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in Community Support that this question is:
- points to mlmcc
Please leave any comments here within the
next seven days.
Comment from expert accepted as answer
Computer101
E-E Admin
Computer101
E-E Admin
http://www.freevbcode.com/ShowCode.Asp?ID=1813
mlmcc