Paint with system brushes and colors. : Brush « Windows Presentation Foundation « C# / CSharp Tutorial






<Window  
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    x:Class="SystemColorsAndBrushes_markup.Window1"
    Title="System Colors" >
   <Window.Resources>
    <Style TargetType="{x:Type Rectangle}">
      <Setter Property="Margin" Value="10,0,10,0"/>
      <Setter Property="HorizontalAlignment" Value="Left"/>
      <Setter Property="Height" Value="20"/>
      <Setter Property="Width" Value="120"/>
      <Setter Property="Stroke" Value="Black"/>
      <Setter Property="StrokeThickness" Value="1"/>
    </Style>
    <Style TargetType="{x:Type TextBlock}">
      <Setter Property="Margin" Value="10,20,10,0"/>
    </Style>
    <Style TargetType="{x:Type Button}">
      <Setter Property="Margin" Value="10,0,10,0"/>
      <Setter Property="HorizontalAlignment" Value="Left"/>
    </Style>
    </Window.Resources>
    <StackPanel Background="White">
        <TextBlock>ActiveBorder</TextBlock>
        <Rectangle Fill="{x:Static SystemColors.ActiveBorderBrush}" />
        
        <TextBlock>ActiveCaption</TextBlock>
        <Rectangle Fill="{x:Static SystemColors.ActiveCaptionBrush}" />
        
        <TextBlock>ActiveCaptionText</TextBlock>
        <Rectangle Fill="{x:Static SystemColors.ActiveCaptionTextBrush}" />
        
        <TextBlock>AppWorkspace</TextBlock>
        <Rectangle Fill="{x:Static SystemColors.AppWorkspaceBrush}" />
        
        <TextBlock>Control</TextBlock>
        <Rectangle Fill="{x:Static SystemColors.ControlBrush}" />
        
        <TextBlock>ControlDark</TextBlock>
        <Rectangle Fill="{x:Static SystemColors.ControlDarkBrush}" />
        
        <TextBlock>ControlDarkDark</TextBlock>
        <Rectangle Fill="{x:Static SystemColors.ControlDarkDarkBrush}" />
        
        <TextBlock>ControlLight</TextBlock>
        <Rectangle Fill="{x:Static SystemColors.ControlLightBrush}" />
        
        <TextBlock>ControlLightLight</TextBlock>
        <Rectangle Fill="{x:Static SystemColors.ControlLightLightBrush}" />
        
        <TextBlock>ControlText</TextBlock>
        <Rectangle Fill="{x:Static SystemColors.ControlTextBrush}" />
        
        <TextBlock>Desktop</TextBlock>
        <Rectangle Fill="{x:Static SystemColors.DesktopBrush}" />
        
        <TextBlock>GradientActiveCaption</TextBlock>
        <Rectangle Fill="{x:Static SystemColors.GradientActiveCaptionBrush}" />
        
        <TextBlock>GradientInactiveCaption</TextBlock>
        <Rectangle Fill="{x:Static SystemColors.GradientInactiveCaptionBrush}" />
        
        <TextBlock>GrayText</TextBlock>
        <Rectangle Fill="{x:Static SystemColors.GrayTextBrush}" />
        
        <TextBlock>Highlight</TextBlock>
        <Rectangle Fill="{x:Static SystemColors.HighlightBrush}" />
        
        <TextBlock>HighlightText</TextBlock>
        <Rectangle Fill="{x:Static SystemColors.HighlightTextBrush}" />
        
        <TextBlock>HotTrack</TextBlock>
        <Rectangle Fill="{x:Static SystemColors.HotTrackBrush}" />
        
        <TextBlock>InactiveBorder</TextBlock>
        <Rectangle Fill="{x:Static SystemColors.InactiveBorderBrush}" />
        
        <TextBlock>InactiveCaption</TextBlock>
        <Rectangle Fill="{x:Static SystemColors.InactiveCaptionBrush}" />
        
        <TextBlock>InactiveCaptionText</TextBlock>
        <Rectangle Fill="{x:Static SystemColors.InactiveCaptionTextBrush}" />
        
        <TextBlock>Info</TextBlock>
        <Rectangle Fill="{x:Static SystemColors.InfoBrush}" />
        
        <TextBlock>InfoText</TextBlock>
        <Rectangle Fill="{x:Static SystemColors.InfoTextBrush}" />
        
        <TextBlock>Menu</TextBlock>
        <Rectangle Fill="{x:Static SystemColors.MenuBrush}" />
        
        <TextBlock>MenuBar</TextBlock>
        <Rectangle Fill="{x:Static SystemColors.MenuBarBrush}" />
        
        <TextBlock>MenuHighlight</TextBlock>
        <Rectangle Fill="{x:Static SystemColors.MenuHighlightBrush}" />
        
        <TextBlock>MenuText</TextBlock>
        <Rectangle Fill="{x:Static SystemColors.MenuTextBrush}" />
        
        <TextBlock>ScrollBar</TextBlock>
        <Rectangle Fill="{x:Static SystemColors.ScrollBarBrush}" />
        
        <TextBlock>Window</TextBlock>
        <Rectangle Fill="{x:Static SystemColors.WindowBrush}" />
        
        <TextBlock>WindowFrame</TextBlock>
        <Button Width="120" Height="20" Background="{x:Static SystemColors.WindowFrameBrush}" />
        
        <TextBlock>WindowText</TextBlock>
        <Button Width="120" Height="20" Background="{x:Static SystemColors.WindowTextBrush}" />
      </StackPanel> 

  
</Window>
WPF Paint With System Brushes And Colors








24.81.Brush
24.81.1.Set color for SolidColorBrushSet color for SolidColorBrush
24.81.2.Paint with system brushes and colors.Paint with system brushes and colors.
24.81.3.Uses a predefined SolidColorBrush, defined by the System.Windows.Media.Brushes classUses a predefined SolidColorBrush, defined by the System.Windows.Media.Brushes class
24.81.4.Gradient brushes within a DrawingBrush. Two overlapping gradients are layeredGradient brushes within a DrawingBrush. Two overlapping gradients are layered
24.81.5.OpacityMask, LinearGradientBrush, RenderTransformOpacityMask, LinearGradientBrush, RenderTransform
24.81.6.Brush resourceBrush resource
24.81.7.Use a VisualBrush to magnify a portion of the screen.Use a VisualBrush to magnify a portion of the screen.
24.81.8.Predefined brush in Brushes ClassPredefined brush in Brushes Class
24.81.9.Solid Color Brush In Code with predefined brushSolid Color Brush In Code with predefined brush
24.81.10.Solid Color Brush In Code with SolidColorBrushSolid Color Brush In Code with SolidColorBrush
24.81.11.Solid Color Brush In Code with SolidColorBrush and RGB colorSolid Color Brush In Code with SolidColorBrush and RGB color
24.81.12.Get all public static properties from Brush
24.81.13.Change the Window background with a Brush
24.81.14.Using Brushes.AliceBlue
24.81.15.Color map Brush
24.81.16.Create Vector from width and height