PDA

Click to See Complete Forum and Search --> : Creating odd shaped command Buttons


amitabh
Aug 31st, 2000, 05:05 AM
Can somebody help me in creating odd shaped command buttons? As far as I know, there are some api's(CreateRoundRect) which help you in performing the said function, but I am unable to use it. Also, what if I would like to create a command button of any shape based on some picture?


Thanks
Amitabh

WP
Aug 31st, 2000, 05:39 AM
dont ask your question twice!

WP

eanilarora
Aug 31st, 2000, 07:46 AM
I have not done it myself but i think it should be ver easy stuff.
Only thing is that you have to be creative

first draw a couple of images in your favorite image editor.
one for a normal button and other for the pressed one.

You can place these images over a picture control. At run time when then user click over it you can write a code for showing the other picture till the time the mouse is down and when the user releases the mouse (MouseUp) you can show the orignal image.

this should work.

If it does not then do mail me and i'll try'n do it for you.
Happy

Mad Compie
Aug 31st, 2000, 12:55 PM
You should also use the API's SetCapture() and RelaseCapture().
There is a lot of sample codes available about using "skins" (graphical user interfaces) which implement such buttons. Just search on the web. I always use http://www.google.com to find the best results...

Arcom
Aug 31st, 2000, 04:17 PM
How about creating ActiveX control?

To create buttons based on some picture, create a picture in any image editor. Fill the parts that have to be "transparent" in any color which is different from all the others (i.e. magenta, light gray, white).

Now create ActiveX Control project. Set controls' BackStyle property to Transparent. In Picture and MaskPicture properties load the picture you've previously created. Finally, set the MaskColor property to the color that should be transparent (look up).

Basically that's it, but you'll have to add some code though :)

hitcgar
Sep 1st, 2000, 02:48 PM
you can also do this using simple image controls.

just use icons instead of bmp's then get the mousemove, down
and click events to change the images.

the actual icon images can be stored either as image controls
on the page, an imagelist control or in a resource file.
Res files are best as they don't take up memory until the
resource is actually loaded.

you need 4 images for each button (3 if you don't need a
web style mouseover event).
1. the visible 'button' with 'idle' image
2. the mousemove image
3. the mousedown image
4. the invisible 'idle' image

just switch the picture property for the main visible image control for each event.

use the mousemove event of the container (form or
picturebox or whatever) to change the image back to it's
'idle' status image.



that's a lotta controls needed for one measley button!
SO:
you should write an ActiveX UserControl with the above-mentioned functionality (as someone else mentioned)
- it'll make life a lot easier.

Arcom
Sep 1st, 2000, 05:30 PM
Using Image controls is not so bad idea, but the basis of non-rectangular button is that it recieves mouse events only on VISIBLE areas. That's way creating ActiveX Control is better if you have lots of those buttons.

Mad Compie
Sep 2nd, 2000, 02:41 AM
You can also use VB6's ImageList OCX control, which lets you also choose the MaskColor for transparent pictures.