Does anyone know how to make custom shape buttons, something like arrows, circles and ovals.
Any help would be appreciated.
Printable View
Does anyone know how to make custom shape buttons, something like arrows, circles and ovals.
Any help would be appreciated.
well, if you created normal buttons, you could cut them at certain places (using SetWindowRgn). But they wouldn't be 3-D. I can give you an example if you so desire!
you may also want to consider the LCARS button from kedaman
http://www.geocities.com/kedasu/kedacode.html
i can turn any object into a button including the form. So when you click it it goes down then up. if you want a ex.. telll me,
it goes like this though
Object = well like a label name or picture name ex:
lblYourName
try it thoughCode:on mouse down put this code
object appearance = 0
object borderstyle = 0
then on mouse up put
object appearance = 1
object borderstyle = 1
I hope this helped if it did tell me please thank you.
i think mines would be esier cause u can draw a shape and pake it into a button . Am i right ?
yeh, but your method won't support curves, i don't know if windows can draw 3d in curves. You may have to use an image with white on the top and black on the bottom and swap it to get the 3d effect on a curved surface
ive drawn curves before... (createellipticalrgn)
Is this what you meant?
Any examples would be appreciated.
One of my favorite subjects in VB is control creation.
It is not too hard to create any kind of button you like by making your own "owner drawn" activeX controls.
All you need is a good book to get you started.
I will send an example soon. (have to make one first!)
Look at this example on vbworld for odd shaped forms and you will get a way to change the shape of any window that exposes it handle property. http://www.vb-world.net/articles/shapedforms/
I have once created a circular button. What I did was that I used the CreateEllipticRgn APi on a usercontrol. Then 2 arcs were drawn at the edges of the circle, one black and one white . And in the mousedown and mouseup events you can switch the colors to produce the pressing effect
Do anyone has anyideas to create a round 3d form?
I would imagine you could probably create one the same way as the button. Just supply the form handle instead of the button one.
Public Declare Function CreateEllipticRgn Lib "gdi32" Alias "CreateEllipticRgn" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Public Declare Function SetWindowRgn Lib "user32" Alias "SetWindowRgn" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
private sub form_Load()
dim hrgn as long
hrgn=createellipticrgn(0,0,button1.width/screen.twipsperpixelx,button1.height/screen.twipsperpixelsy)
setwindowrgn button1.hwnd,hrgn,true
End Sub
Incase of problems Please EMail Me.
I thought you may like to know what the conclusion of my testing all the different suggestions made regarding my question.
JasonLpz
A good suggestion if you want something quick to code but not really efficient. I you perform a lot of rapid mouse clicks there are some mouse clicks which are missed and nothing happens at all.
KrishnaSantosh
The efficiency loss mentioned above is overcome and not a single mouse click is lost. Unfortunately you loose some of the 3D look.
crptblade
The LCars button is not 3D
faisalkm
I think this is the preffered method as it will give greater scope for custom functionality and is really a more refined version of the KrishnaSantosh version.
thanks to everyone who posted suggestions.
If you do use KrishnaSantosh's code, remember to use deleteobject api call just after SetWindowRegion to free up memory.