code-cracker
asked on
changing form or window shape!!!
Back again,
how can u change the shape of the window or the form using api's.for eg the windows that sonique etc have.tell me any other way if not in VB to do that.
Bye
how can u change the shape of the window or the form using api's.for eg the windows that sonique etc have.tell me any other way if not in VB to do that.
Bye
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
'Form1, Borderstyle = none
'Picturebox = picMainSkin
'CommandButton = Command1
Option Explicit
Private Sub Command1_Click()
MsgBox "This is a real working form!"
End Sub
Private Sub Form_Load()
Dim WindowRegion As Long
' I set all these settings here so you won't forget
' them and have a non-working demo... Set them in
' design time
picMainSkin.ScaleMode = vbPixels
picMainSkin.AutoRedraw = True
picMainSkin.AutoSize = True
picMainSkin.BorderStyle = vbBSNone
Me.BorderStyle = vbBSNone
Set picMainSkin.Picture = LoadPicture(App.Path & "\main.bmp")
Me.Width = picMainSkin.Width
Me.Height = picMainSkin.Height
WindowRegion = MakeRegion(picMainSkin)
SetWindowRgn Me.hWnd, WindowRegion, True
End Sub
Private Sub picMainSkin_MouseDown(Butt on As Integer, Shift As Integer, X As Single, Y As Single)
' Pass the handling of the mouse down message to
' the (non-existing really) form caption, so that
' the form itself will be dragged when the picture is dragged.
'
' If you have Win 98, Make sure that the "Show window
' contents while dragging" display setting is on for nice results.
ReleaseCapture
SendMessage Me.hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&
End Sub
'Picturebox = picMainSkin
'CommandButton = Command1
Option Explicit
Private Sub Command1_Click()
MsgBox "This is a real working form!"
End Sub
Private Sub Form_Load()
Dim WindowRegion As Long
' I set all these settings here so you won't forget
' them and have a non-working demo... Set them in
' design time
picMainSkin.ScaleMode = vbPixels
picMainSkin.AutoRedraw = True
picMainSkin.AutoSize = True
picMainSkin.BorderStyle = vbBSNone
Me.BorderStyle = vbBSNone
Set picMainSkin.Picture = LoadPicture(App.Path & "\main.bmp")
Me.Width = picMainSkin.Width
Me.Height = picMainSkin.Height
WindowRegion = MakeRegion(picMainSkin)
SetWindowRgn Me.hWnd, WindowRegion, True
End Sub
Private Sub picMainSkin_MouseDown(Butt
' Pass the handling of the mouse down message to
' the (non-existing really) form caption, so that
' the form itself will be dragged when the picture is dragged.
'
' If you have Win 98, Make sure that the "Show window
' contents while dragging" display setting is on for nice results.
ReleaseCapture
SendMessage Me.hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&
End Sub
dont out-do yourself on points btw
lol JonFish85 - I didn't even notice!
Hi code-cracker,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will suggest to:
Accept wileecoy's comment(s) as an answer.
**** there really ought to be some sort of bonus system!
code-cracker, if you think your question was not answered at all or if you need help, you can simply post a new comment here. Community Support moderators will follow up.
EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will suggest to:
Accept wileecoy's comment(s) as an answer.
**** there really ought to be some sort of bonus system!
code-cracker, if you think your question was not answered at all or if you need help, you can simply post a new comment here. Community Support moderators will follow up.
EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
Comment from expert accepted as answer
Computer101
E-E Moderator
Computer101
E-E Moderator
The code takes the color in the top leftmost position (coords 0,0) and makes that transparent. The shape of the form then becomes the shape of the bitmap that is not transparent.
What you will want to do is find a bitmap that will work properly if the top left pixel is made transparent through the whole form. You will then want to either rename it to Main.bmp in the app.path, or change the following line of code that is in the form_load event:
Set picMainSkin.Picture = LoadPicture(App.Path & "\main.bmp")
the first comment is the module code, the second is the form code.
Unfortunately, I cannot properly credit the author - I downloaded it.