Fills the polylines with a light gray color : Color « Windows Presentation Foundation « C# / C Sharp






Fills the polylines with a light gray color

Fills the polylines with a light gray color
  


<Window x:Class="WpfApplication1.Polygons"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Polygons"
  Height="300" Width="300">
  <Grid>


    <StackPanel Name="stackPanel1" Margin="10">
      <TextBlock Text="Polygon:" />
      <Polygon Stroke="Black" StrokeThickness="3" Fill="LightGray"
        Points="0 170,60 110,180 60,160 110,210 170" />
      <TextBlock Text="Filled sine curve:" Margin="0 10 0 0" />
      <Polygon Name="polygon1" Stroke="Red" StrokeThickness="2"
        Fill="LightCoral" />
    </StackPanel>
  </Grid>
</Window>
//File:Window.xaml.cs

using System;
using System.Windows;
using System.Windows.Media;
using System.Windows.Shapes;


namespace WpfApplication1
{
    public partial class Polygons : Window
    {
        public Polygons()
        {
            InitializeComponent();
            for (int i = 0; i < 71; i++)
            {
                double x = i * Math.PI;
                double y = 40 + 30 * Math.Sin(x / 10);
                polygon1.Points.Add(new Point(x, y));
            }
        }
    }
}

   
    
  








Related examples in the same category

1.Color AnimationColor Animation
2.Highlights the gradient origin and the gradient circle
3.using Color structuresusing Color structures
4.Use System Color to draw LineUse System Color to draw Line
5.This text uses a gradientThis text uses a gradient
6.Diagonal Linear GradientDiagonal Linear Gradient
7.A Partially Transparent ButtonA Partially Transparent Button
8.A Radial GradientA Radial Gradient
9.A Radial Gradient with an Offset CenterA Radial Gradient with an Offset Center
10.GradientStop with Transparent colorGradientStop with Transparent color
11.Simulating lighting effects with linear fillsSimulating lighting effects with linear fills
12.Color Converter With String FormatColor Converter With String Format
13.Colors and BrushesColors and Brushes
14.From a Hex string using ColorConverterFrom a Hex string using ColorConverter
15.From ScRGB values in the Color structureFrom ScRGB values in the Color structure
16.From sRGB values in the Color strutcureFrom sRGB values in the Color strutcure
17.From predefined color name in the Colors classFrom predefined color name in the Colors class
18.Using SystemColors in CodeUsing SystemColors in Code
19.using system colors to create gradientsusing system colors to create gradients