I need to change a button from its inherited color to something else. That's easy enough to do, but it seems to also change the default visual style (i.e. two-tone) to a single color button.
I've poked around and read a few things about resetting the UseVisualStyleBackColor property before setting the BackColor property. But the best I've been able to do so far is change the color of the button text -- the button color itself stays the same.
Maintain visual style for button
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
-
- Posts: 107
- Last visit: Thu Apr 29, 2021 8:47 am
-
- Posts: 107
- Last visit: Thu Apr 29, 2021 8:47 am
Maintain visual style for button
I need to change a button from its inherited color to something else. That's easy enough to do, but it seems to also change the default visual style (i.e. two-tone) to a single color button.
I've poked around and read a few things about resetting the UseVisualStyleBackColor property before setting the BackColor property. But the best I've been able to do so far is change the color of the button text -- the button color itself stays the same.
I've poked around and read a few things about resetting the UseVisualStyleBackColor property before setting the BackColor property. But the best I've been able to do so far is change the color of the button text -- the button color itself stays the same.
Mike
Maintain visual style for button
Swet UseVisualStyleBackColor and select the color you want from the dropdown.
The colors are limited to what is in the dropdown and that will vary from system to system. ALL are cross compatible. I think Win7 has more variations but I am not sure.
The colors are limited to what is in the dropdown and that will vary from system to system. ALL are cross compatible. I think Win7 has more variations but I am not sure.
-
- Posts: 107
- Last visit: Thu Apr 29, 2021 8:47 am
Maintain visual style for button
Yeah, I get how the color can be changed. What I can't do is change the color AND maintain the modern look-and-feel of the default. If I set UseVisualStyleBackColor to $true, set the backcolor to something, it stays grey:
If I set the FlatStyle property to Flat or PopUp the new color shows up. But then it loses the visual style:
Here the general idea of what I am hoping to achieve:
If I set the FlatStyle property to Flat or PopUp the new color shows up. But then it loses the visual style:
Here the general idea of what I am hoping to achieve:
Mike
Maintain visual style for button
You can't have both. VisualStyle limits you to the 'chrome' and teh colors of the 'theme'. Flat and Popup do not use the chrome or them. "Flat' means flat not fancy.
You can get custom controls that will do what you are trying to do.d
You can get custom controls that will do what you are trying to do.d
-
- Posts: 107
- Last visit: Thu Apr 29, 2021 8:47 am