wacko41
asked on
Ugly Picture on disabled button
Hello,
I have a problem with my icons(bmp format) on the command buttons i made. I made xp style icons to put on my buttons. When the button is enabled they look great, but when they are disabled they look ugly. See link for example.
Url: http://home.kabelfoon.nl/~idrissi/Buttons/
I am using Acces 97.
I tried using .ico files instead .bmp but that did not work. Has anyone some suggestions how improve the looks of the disabled buttons.
I prefer not to work with swap images or external ocx controls. The best solution would be a solution that uses the resources that access standard provides. But if that's impossible i'm all ears for any other solution.
Thanks,
F.
I have a problem with my icons(bmp format) on the command buttons i made. I made xp style icons to put on my buttons. When the button is enabled they look great, but when they are disabled they look ugly. See link for example.
Url: http://home.kabelfoon.nl/~idrissi/Buttons/
I am using Acces 97.
I tried using .ico files instead .bmp but that did not work. Has anyone some suggestions how improve the looks of the disabled buttons.
I prefer not to work with swap images or external ocx controls. The best solution would be a solution that uses the resources that access standard provides. But if that's impossible i'm all ears for any other solution.
Thanks,
F.
try this one,
Use same picture for "DisabledPicture" Property.
I used in normal button it will display clearly, Apply this property and check this one
Use same picture for "DisabledPicture" Property.
I used in normal button it will display clearly, Apply this property and check this one
Hi, wacko41.
senthil_msv's method works for me using VB 6. If you happen to be using VBA (Excel, for example) where there is no DisabledPicture property, you can build on shijusn's comment as follows:
Add to General Declarations:
Dim buttonDisable As Boolean
Add to beginning of Command1's Click event:
If buttonDisable = True Then
Exit Sub
End If
When you want Command1 to be "disabled" instead of using Command1.Enabled = False, use this code:
buttonDisable = True
When you want Command1 to be "enabled" again:
buttonDisable = False
senthil_msv's method works for me using VB 6. If you happen to be using VBA (Excel, for example) where there is no DisabledPicture property, you can build on shijusn's comment as follows:
Add to General Declarations:
Dim buttonDisable As Boolean
Add to beginning of Command1's Click event:
If buttonDisable = True Then
Exit Sub
End If
When you want Command1 to be "disabled" instead of using Command1.Enabled = False, use this code:
buttonDisable = True
When you want Command1 to be "enabled" again:
buttonDisable = False
ASKER
Hi,
thanks for the comments so far but is's not quite what i'm looking for. I don't want to write code to do nothing if Disabled mode is selected. That is not user-friendly. Because when a button looks enabled then it should be enabled and vice versawith disabled buttons. A button shoud do what the user expects it to do.
So what i'm looking for is a way to improve the looks of a disabled button. Oh by the way I'm using VB in acces 97 so there is no "DisabledPicture" Property".
it seems the problem is tougher then i thought.......
Wacko41
thanks for the comments so far but is's not quite what i'm looking for. I don't want to write code to do nothing if Disabled mode is selected. That is not user-friendly. Because when a button looks enabled then it should be enabled and vice versawith disabled buttons. A button shoud do what the user expects it to do.
So what i'm looking for is a way to improve the looks of a disabled button. Oh by the way I'm using VB in acces 97 so there is no "DisabledPicture" Property".
it seems the problem is tougher then i thought.......
Wacko41
Okay, here's another idea. Add an Image ("Image1") to your Userform (anywhere), set its Picture to the same picture you've got for your CommandButton1, set the PictureSizeMode until it looks right (I had to use "fmPictureSizeModeStretch" ) and set its Visible property to "False". Add the following code to either a Procedure (if you've got multiple sources that set CommandButton1's Enabled property to "False") or to a Command button, etc. (if you have only one or two events that cause CommandButton1 to become disabled):
CommandButton1.Enabled = False
Image1.Top = CommandButton1.Top
Image1.Left = CommandButton1.Left
Image1.Width = CommandButton1.Width
Image1.Visible = True
Then (same as above based on frequency of button disabling) to re-enable CommandButton1:
CommandButton1.Enabled = True
Image1.Visible = False
This will truly disable your command button when its Enabled property is set to "False" by painting over the entire surface of the command button with your Image1.Picture.
It's as nice a solution as being able to just set the DisabledPicture to the same picture, but it's close:)
CommandButton1.Enabled = False
Image1.Top = CommandButton1.Top
Image1.Left = CommandButton1.Left
Image1.Width = CommandButton1.Width
Image1.Visible = True
Then (same as above based on frequency of button disabling) to re-enable CommandButton1:
CommandButton1.Enabled = True
Image1.Visible = False
This will truly disable your command button when its Enabled property is set to "False" by painting over the entire surface of the command button with your Image1.Picture.
It's as nice a solution as being able to just set the DisabledPicture to the same picture, but it's close:)
ASKER
Hi,
Doesn't anyone kwnows a smart way to swap the enabled picture with another when the state of a button is changed. The image could be provided from a image list. But how can i catch the action when a button state is changed to enabled or disabled from a procedure. It has to be procedure beacuse i have a lot of buttons.
thanks,
F.
Doesn't anyone kwnows a smart way to swap the enabled picture with another when the state of a button is changed. The image could be provided from a image list. But how can i catch the action when a button state is changed to enabled or disabled from a procedure. It has to be procedure beacuse i have a lot of buttons.
thanks,
F.
Hi,
Try to change the pic format and/or color depth - I think it will work...
Try to change the pic format and/or color depth - I think it will work...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
As Shiju says create new images for diabled buttons, otherwise whatever the image is will be greyed out..
Hi, GPrentice00. wacko41 is using Access VBA, so the comments posted above applicable to VB 6 aren't viable. I agree with him that a more elegant solution would be desirable, but I did present solutions that work in a VBA environment.
yes, the irony of Visual Basic 6 being built ontop of the VBA engine.
and NOT disable the buttons, instead write code to do nothing if Disabled mode is selected.
definitely u need to put some extra code to work it out.
;-)
Shiju