How to change the BarButtonItem back color? - winforms

I am currently working in the C# windows application with DevExpress controls.
Now I want to change back color of bar button item while loading the form.
I've tried following code:
barButton.Appearance.BackColor = Color.Red;
but the bar button back color not changed to red.

By default, bars use the skins to draw their content. In this case, all background colors are provided by specific skin elements, which cannot be changed. The only way to change a specific item's background color is to disable skins:
put the BarAndDockingController component onto a form, and assign it to the BarManager.Controller property. Set BarAndDockingController.PaintStyleName or LookAndFeel to any non-skin style(for example "Flat"). Then use the Bar.Appearance.BackColor property to set the desired color.
Alternatively, you can create your own custom barItem in a way similar to the one described in the How to change the background color of highlighted links KB article.

Related

TreeItem of material-ui to be focused by right-clicking

Please teach me how to control the background color when right-clicking on TreeView/TreeItem.
Based on https://codesandbox.io/s/jggxz?file=/demo.tsx which is linked from https://material-ui.com/components/tree-view/ ,
in the case of implementing the context menu function, the background color of the right-clicked item is not as expected.
Let me explain how it works by watching the attached video.
Right-click on "Forums" to bring up the context menu.
Then, for a brief moment, "Forums" will get the focus and the background color will change to pink.
After the background color disappears, the context menu will appear.
Also, up to this point, the background color of "Promotions", which was selected from the beginning, is always green.
What I want is the following. What should I do to make it look like the following?
Right-click on "Forums" to bring up the context menu.
Then the background color of the right-clicked item "Forums" will change to green, and
at the same time, the background color of the selected "Promotions" from the beginning will disappear.
Another thing I tried was to use TreeView's "selected" props and useState, but it did not work as expected.
That version is below.
https://codesandbox.io/s/material-demo-forked-h5z8e?file=/demo.tsx

How to change selected tab background in codenameone?

I'm doing sample on Tabs and its working fine but here my question how to show differentiate between selected and non selected Tabs in codenameone. it means after selecting Tab i want to show different background color.
how can i achieve this?
Change the background color of the selected state of Tab Uiid in your Codename One Designer.

Trouble changing background color of TextField in Codename One

I just started building my first App with Codename One and I'm having quite some trouble. :-)
I cant change the background color of a TextField, I changed everything in the Theme and named it "TextField". At the Color tab I changed the background color and set Transparency to 255. Since the Component is named TextField, shouldnt the style be applied automatically when I make a new TextField?
I also tried to set the UIID manually to "TextField", which didn't help either.
Am I missing something?
Kind regards,
Max
The way backgrounds work in Codename One is this:
Border is applied first
Then image
Then gradient
Then color
TextField and other components such as Button etc. often have a default border derived from the theme.
Switch to the Border tab, click derive then click the ... button and select empty.

How do I set the color of the radio button's control?

How do I set the color of the radio button's control? No matter what color I specify in the style, it draws the outer circle and inner bullet in black. I want it to draw in in white on a black background to match my theme, but it always draws in black. (I'm actually doing this in a Multi-Button, setting the color of the Emblem UIID.)
I tried the first suggestion, to define the constants. That didn't work. Here's what happened.
I tried it two ways. First I defined just the radioSelectedImage and radioUnselectedImage. When that didn't work, I added both the radio*DisImage values, but it did the same thing. The selected and unselected images worked fine, but as soon as I touched a radio button, it got the focus, and the button was drawn in black, which made it invisible against my black background.
I did find an approach that worked, but it required the use of two deprecated classes. Here's what I added to the init() method of my main class:
LookAndFeel lookAndFeel = UIManager.getInstance().getLookAndFeel();
if (lookAndFeel instanceof DefaultLookAndFeel) {
DefaultLookAndFeel defaultLookAndFeel = (DefaultLookAndFeel) lookAndFeel;
Image sel = theme.getImage("RadioButtonSelected.png");
Image unSel = theme.getImage("RadioButtonUnselected.png");
defaultLookAndFeel.setRadioButtonImages(sel, unSel, sel, unSel);
defaultLookAndFeel.setRadioButtonFocusImages(sel, unSel, sel, unSel);
}
The difference here is that I have a way to set the focus images. I can't do that using the constants, which is probably why it doesn't work. I'd really rather not use deprecated classes.
There are theme constants to allow you to add images to the radio button for unselected, selected, etc. Look here...
https://www.codenameone.com/manual/advanced-theming.html

can I change ngStyle from other file

I know the basic things in Angular.js and I want to change the background color a page from other page... like a config section
I mean... I have conf.html and I have two radioButtons, one of them change the background color to Black and the other one change to white color.
I have an other page, home.html, that page I need to change when the user select any of that radioButton options.
This example work but if the radiobuttons change the same page, like this example https://docs.angularjs.org/api/ng/directive/ngStyle all the modifiers is in the same page.
Some idea? thanks.

Resources