04-15-2009 12:14 PM
I'm looking for a way to make a button transparent but still allow the application events to occur when selected. I'm try to put an image on a panel then just select parts of the image to make different things happen.
Yes, reading the mouse coordinates and then performing the appropriate action would be one way accomplish this but having a button with a callback would be cleaner. Any ideas?
04-15-2009 04:11 PM
Hi Craige,
If you modify the z-coordinate of the button to place it behind some other control on the panel, its hotkey would still be active, but it would not be selectable with the mouse. Alternatively, to make the button transparent, you can change its colour to transparent by selecting 'T' in the colour pallette, when editing its properties (click the paint button and right-click to bring up the pallette). You may also need to change the colour of its border. Delete any text that would normally be on the button. I guess that you might then be able to place it on top of your image.
John.
04-15-2009 04:14 PM
04-16-2009 03:20 AM
I avoid the "dotted box around label" issue by moving the label so it is off the visible screen. (Either in the GUI editor or programmatically). Panels are so much nicer without the dotted boxes everywhere. ![]()
JR
04-16-2009 03:46 AM
@JR: command button label cannot be moved outside the control...
Actually I have to correct myself and add a trick: if the panel hase the "Conform to system colors" enabled, nonebutton can be painted in a different color, but if you disable that attribute, paint the button in transparent and then re-enable it, the transparent color is maintained (and this is true also for round and oblong classic-style command button).
04-16-2009 03:58 AM
If you use a Picture button, you can move the label off screen. In fact you can make the button transparant easily and achieve the OP's objective.
JR
04-16-2009 04:53 AM
Aha! I hadn't considered the picture command button....
Even with this you must uncheck windows visual style for controls and conform to system colors before painting it in transparent and recheck them again after painting. And this trick works with standard "lab-style" controls too!
I wonder if such a trick can introduce some unwanted behaviour in the application...
04-16-2009 08:44 AM
Great! Looks like there are plenty of ways to accomplish this.Thanks for the help.
Craig