Mega Code Archive

 
Categories / C# / WPF
 

Using Color structures

<Window x:Class="WpfApplication1.ShapesWindow"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     Title="ShapesWindow" Height="160" Width="400">       <Window.Resources>         <Style TargetType="{x:Type Rectangle}">                      <!-- Gives all the rectangles in this panel a white stroke. -->           <Setter Property="Stroke" Value="White"/>           <Setter Property="StrokeThickness" Value="1"/>         </Style>       </Window.Resources>     <Canvas>       <Rectangle Width="50" Height="50">         <Rectangle.Fill>           <SolidColorBrush>             <SolidColorBrush.Color>               <!-- Describes the brush's color using                     ScRGB values. Each value has a range                     of 0-1.  -->               <Color ScA="1.0" ScR="0.0" ScG="0.0" ScB="1.0" />             </SolidColorBrush.Color>           </SolidColorBrush>         </Rectangle.Fill>       </Rectangle>     </Canvas> </Window>