|
-
Feb 16th, 2001, 01:41 AM
#1
Thread Starter
Lively Member
some application can define it's form's shape by a bitmap'mask color (e.g. K-JOFOL,it' skin bitmap's magenta area make the form transparent).Can I do it with VB
-
Feb 16th, 2001, 03:29 AM
#2
Hyperactive Member
-
Feb 16th, 2001, 04:16 AM
#3
much easier way. Check this out:
Option Explicit
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 Form_Load()
Dim hr&, dl&
Dim usew&, useh&
usew& = form1.Width / Screen.TwipsPerPixelX
useh& = form1.Height / Screen.TwipsPerPixelY
hr& = CreateEllipticRgn(0, 0, usew, useh)
dl& = SetWindowRgn(form1.hWnd, hr, True)
End Sub
You can reshape forms, buttons, etc. with this api call.
Be sure and put it in the form_resize event as well, if applicable.
Simply give the api call the handle to a region you created with any number of different api calls:
CreateEllipticRgn
CreatePolygonRgn
CreateRectRgn
Note: be sure to delete the region with DeleteObject api call when done with it. Otherwise, byebye resources. There are many ways to manipulate a region, even combine 2 of them in an and/or etc. (CombineRgn - duh)
Have Fun! Experiment! Create forms with holes in them, etc! This is another often-overlooked function that is fun for the whole family! etc. etc. you get the idea...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|