RRButton without the "Button"

Started by Robert Eaton, January 25, 2012, 11:51:13 PM

Previous topic - Next topic

Robert Eaton

The Börje Hagsten RRButton is great but often I’d like to use images without the “button” but there are a couple of problems with doing that.

1)   The button has a “phantom” background color that I so far haven’t been able to change. You can see this color in the first image. If you use rounded corners it makes this more obvious there seems to be no way to change this phantom background. Changing the background color or using transparent or opaque settings seems to make no difference (sometimes it appears to work in the designer but comes back when compiled).

2)   The other issue which I can work around is I don’t want the outline of the button to be drawn either. I found where that can be turned off in the source code.

Picture 1 shows the pesky background color “corners”

Picture 2 shows the effect that I am trying to achieve. (The button drawing is turned off in the control and I’m using a hot image for mouseover). This only works if I make the form color the same as the phatom button background color.

Picture 3 shows what happens if I change the form color.

When I was using VB6 I used an Active-X control (Arcadia Powerbutton) to create buttons like this.

Any idea where that phantom background is coming from?

Thanks,
Bob

Robert Eaton

It looks like the line that I needed to find is this:
FillRect memDC, rc, GetSysColorBrush(%COLOR_BTNFACE) 'cls entire memDC

Creating a brush in the background color and putting it in here lets me make the button disappear (plus you need to disable the button drawing). I put together a sample with some buttons along with the compiled program to show them work (each button has three image icons).

If there is any interest I can post the project with the modified RRButton file.




Marc van Cauwenberghe

There certainly is interest!
I should note that the RRButton that comes with FF is a modified version of the original version.

Thanks,
Marc


Robert Eaton

I actually used the original version to help track down what I needed to change.

The project is attached as well as the modified RRBUTTON control.

I added messages to the control so that you "should" be able to use it normally. (I don't understand all I know about this stuff so use at your own risk and make a backup ;D ). Feel free to check my work. Changed code has -->'Jan-29-2012 Bob Eaton

Put the modified control in your RRBUTTON custom control folder.

The two new messages that I added:
 
'for each control
  SendMessage (HWND_FORM1_CMDOPEN, %RBM_SETBUTTONOL, 0, 0)  'turn off button outline
  SendMessage (HWND_FORM1_CMDOPEN, %RBM_SETFACECOLOR, &HFFC0C0, 0) 'change to match form background


The first message turns off drawing the button outline.
The second message sends a custom button face color.

They won't look correct in the editor of course.
(Would be nice to have these options in FF4, hint hint  :D )

For images I've had the best luck using icons with a single image. I use Axialis Icon Workshop. I used icons from the Professional Toolbar Pack and used the program to add the drop shadows and hot images.




David Warner

What a nice little example project, thanks for sharing Robert.

Marc van Cauwenberghe

#5
Hi Robert,

Is your version a modified original or modified from Paul's version.
I do not want to lose Paul's enhancements.

Thanks for the project!

Regards,
Marc

Robert Eaton

Marc,
The control is modified from Paul's version. It should run normally. Of course this feature will go away in an FF update unless Paul includes it or you manually replace the file again. This is probably not the best solution for what I'm trying to do. A new custom control that is basically a stripped down RRBUTTON control would probably be better. But of course that wouldn't be as convenient since it wouldn't be in the FF toolbox.

David,
Thanks. I may post the other little program (Photo Stand shown in the first post) if I get it far along enough. I have a friend who does a small side business of taking pictures at high school sporting events and selling them. He brings a couple of computers with him and was looking for a simple  program to display the images for sale. He doesn't want the user to be able to do any thing but browse the images. This seemed like a fun little project. I needed to create a thumbnail display and originally considered an array of fireimage controls. A better solution turned out to be using GDI+ to draw the thumbnails on the form (thanks to guidance from Jose ).


Marc van Cauwenberghe

OK, thanks Robert.

Why should you need a stripped down version? I just know Paul will include this in any update that is coming.
Ain't I right Paul?

Marc