Set color for SolidColorBrush : Brush « Windows Presentation Foundation « C# / C Sharp






Set color for SolidColorBrush

Set color for SolidColorBrush
      


<Window x:Class="WPFBrushes.ColorAndAlpha"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  Title="Alpha Channel" Height="300" Width="300">
    <Grid VerticalAlignment="Center" HorizontalAlignment="Center">

        <Rectangle Height="50" Width="50" Stroke="Black" StrokeThickness="4" Margin="4">
            <Rectangle.Fill>
                <SolidColorBrush>
                    <SolidColorBrush.Color>
                        <Color A="0" R="111" G="110" B="0"/>
                    </SolidColorBrush.Color>
                </SolidColorBrush>
            </Rectangle.Fill>
        </Rectangle>
    </Grid>
</Window>

   
    
    
    
    
    
  








Related examples in the same category

1.Paint with system brushes and colors.Paint with system brushes and colors.
2.Uses a predefined SolidColorBrush, defined by the System.Windows.Media.Brushes classUses a predefined SolidColorBrush, defined by the System.Windows.Media.Brushes class
3.Gradient brushes within a DrawingBrush. Two overlapping gradients are layeredGradient brushes within a DrawingBrush. Two overlapping gradients are layered
4.OpacityMask, LinearGradientBrush, RenderTransform
5.Brush resourceBrush resource
6.Use a VisualBrush to magnify a portion of the screen.Use a VisualBrush to magnify a portion of the screen.
7.Predefined brush in Brushes ClassPredefined brush in Brushes Class
8.Solid Color Brush In Code with predefined brushSolid Color Brush In Code with predefined brush
9.Solid Color Brush In Code with SolidColorBrushSolid Color Brush In Code with SolidColorBrush
10.Solid Color Brush In Code with SolidColorBrush and RGB colorSolid Color Brush In Code with SolidColorBrush and RGB color