Set background color of WPF Textbox in C# code

textBox1.Background = Brushes.Blue; textBox1.Foreground = Brushes.Yellow; WPF Foreground and Background is of type System.Windows.Media.Brush. You can set another color like this: using System.Windows.Media; textBox1.Background = Brushes.White; textBox1.Background = new SolidColorBrush(Colors.White); textBox1.Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0, 0)); textBox1.Background = System.Windows.SystemColors.MenuHighlightBrush;

Change JButton gradient color, but only for one button, not all

You can override the paintComponent method of the JButton instance and paint its Graphics object with one of the following classes that implement the Paint interface: GradientPaint. LinearGradientPaint MultipleGradientPaint RadialGradientPaint import java.awt.Color; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.GradientPaint; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.SwingUtilities; public final class JGradientButtonDemo { … Read more

How to customize UISwitch button in iphone?

You can not modify UISwitch control unless and until you write your own control, But best way so far, you can used UISegmentControl and handle event on it to switch the on.png and off.png images. UISegmentedControl* switchView=[[UISegmentedControl alloc] initWithItems:[[[NSMutableArray alloc] initWithObjects:@”On”,@”Off”,nil] autorelease]]; [switchView setFrame:CGRectMake(20,365,140,28)]; switchView.selectedSegmentIndex=0; switchView.segmentedControlStyle=UISegmentedControlStyleBar; [switchView setImage:[UIImage imageNamed:@”onSelected.png”] forSegmentAtIndex:0]; [switchView setImage:[UIImage imageNamed:@”off.png”] forSegmentAtIndex:1]; [switchView … Read more

Background with 2 colors in JavaFX?

I used a simple layer of background colors to produce a red highlight (similar to Stefan’ suggested solution). /** * file: table.css * Place in same directory as TableViewPropertyEditorWithCSS.java. * Have your build system copy this file to your build output directory. **/ .highlighted-cell { -fx-text-fill: -fx-text-inner-color; -fx-background-color: firebrick, gainsboro; -fx-background-insets: 0, 2 0 0 … Read more

How to use JavaScript to change div backgroundColor

var div = document.getElementById( ‘div_id’ ); div.onmouseover = function() { this.style.backgroundColor=”green”; var h2s = this.getElementsByTagName( ‘h2’ ); h2s[0].style.backgroundColor=”blue”; }; div.onmouseout = function() { this.style.backgroundColor=”transparent”; var h2s = this.getElementsByTagName( ‘h2’ ); h2s[0].style.backgroundColor=”transparent”; };

Is background-color:none valid CSS?

You probably want transparent as none is not a valid background-color value. The CSS 2.1 spec states the following for the background-color property: Value: <color> | transparent | inherit <color> can be either a keyword or a numerical representation of a colour. Valid color keywords are: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, … Read more

WPF Change Background color of a Combobox

Try this <Window.Resources> //Put this resourse n Window.Resources or UserControl.Resources <LinearGradientBrush x:Key=”NormalBrush” StartPoint=”0,0″ EndPoint=”0,1″> <GradientBrush.GradientStops> <GradientStopCollection> <GradientStop Color=”#FFDC3939″ Offset=”0.0″/> <GradientStop Color=”#FFE80E0E” Offset=”1.0″/> </GradientStopCollection> </GradientBrush.GradientStops> </LinearGradientBrush> <SolidColorBrush x:Key=”WindowBackgroundBrush” Color=”#FFFBE618″ /> <ControlTemplate x:Key=”ComboBoxToggleButton” TargetType=”ToggleButton”> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition /> <ColumnDefinition Width=”20″ /> </Grid.ColumnDefinitions> <Border x:Name=”Border” Grid.ColumnSpan=”2″ CornerRadius=”2″ Background=”{StaticResource NormalBrush}” BorderThickness=”1″ /> <Border Grid.Column=”0″ CornerRadius=”2,0,0,2″ Margin=”1″ Background=”{StaticResource WindowBackgroundBrush}” BorderThickness=”0,0,1,0″ … Read more