Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 11

Graficas por Computadora

<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication6"
mc:Ignorable="d"
Title="Linea-Elipse" Height="350" Width="525"
WindowStartupLocation="CenterScreen" ResizeMode="NoResize">
<Grid>
<Ellipse Width="200" Height="150" Stroke="Blue" StrokeThickness="5"
Fill="Cyan" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<Line X1="0" Y1="350" X2="500" Y2="0" Stroke="Red" StrokeThickness="4"
StrokeDashArray="3,3"/>
</Grid>
</Window>

1
Graficas por Computadora

<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication7"
mc:Ignorable="d"
Title="PATH" Height="350" Width="525" ResizeMode="NoResize"
WindowStartupLocation="CenterScreen">
<Grid>
<Path Margin="15" HorizontalAlignment="Center" VerticalAlignment="Top"
Width="AUTO" Height="AUTO" Fill="#FFFF0000" Stroke="#FF000000" StrokeThickness="5"
Data="M41,3 L2,70 78,32 3,19 59,69 41,3"/>
<Polygon HorizontalAlignment="Center" VerticalAlignment="Center"
Points="10,110 60,10 110,110" Fill="Blue" Stroke="Black" StrokeThickness="4"
Canvas.Top="150" />
<Path Margin="15" HorizontalAlignment="Center" VerticalAlignment="Bottom"
Width="AUTO" Height="AUTO" Fill="Red" Stroke="Black" StrokeThickness="5" Data="M41,3
L2,70 78,32 3,19 59,69 41,3"/>
</Grid>
</Window>

2
Graficas por Computadora

<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication8"
mc:Ignorable="d"
Title="CANVAS POLIGONOS" Height="350" Width="525" ResizeMode="NoResize"
WindowStartupLocation="CenterScreen">
<Canvas Height="300" Width="300">
<!-- USO DE CANVAS COMO CONTENEDOR, DIBUJAMOS POLIGONOS EN EL CANVAS -->
<!-- DIBUJAMOS UN TRIANGULO CON RELLENO ROJO -->
<Polygon Points="10,110 60,10 110,110" Fill="Red" />

<!-- DIBUJAMOS UN TRIANGULO CON RELLENO CYAN Y, BORDE NEGRO. EL CANVAS.TOP


COLOCA EL POLIGONO 150 PIXELES HACIA ABAJO -->
<Polygon Points="10,110 60,10 110,110" Fill="Cyan" Stroke="Black"
StrokeThickness="4" Canvas.Top="150" />

<!-- DIBUJAMOS UN TRIANGULO CON RELLENO AZUL. CANVAS.LEFT COLOCA AL POLIGONO


150 PIXELES A LA DERECHA. -->
<Polygon Points="10,110 110,110 110,10" Fill="Blue" Canvas.Left="150" />

<!-- DIBUJAMOS UN TRIANGULO CON BORDE CAFE. EL POLIGONO SE COLOCA 150


PIXELES HACIA ABAJO Y 150 PIXELES A LA DERECHA (CANVAS.LEFT Y CANVAS.TOP).-->
<Polygon Points="10,110 110,110 110,10" Stroke="Brown" StrokeThickness="4"
Canvas.Left="150" Canvas.Top="150" />

</Canvas>
</Window>

3
Graficas por Computadora

<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication9"
mc:Ignorable="d"
Title="BEZIER" Height="350" Width="350" WindowStartupLocation="CenterScreen"
Background="#FF30B8B8" BorderThickness="5,5,5,5" WindowStyle="ToolWindow"
ResizeMode="NoResize" >

<Path Stroke="Red" StrokeThickness="8">


<Path.Data >
<PathGeometry>
<PathGeometry.Figures>
<PathFigureCollection>
<PathFigure StartPoint="90,20">
<PathFigure.Segments>
<PathSegmentCollection>
<PolyQuadraticBezierSegment Points="240,250
240,90 240,00 130,200"/>
</PathSegmentCollection>
</PathFigure.Segments>
</PathFigure>
</PathFigureCollection>
</PathGeometry.Figures>
</PathGeometry>
</Path.Data>
</Path>
</Window>

4
Graficas por Computadora

<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication10"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="350">
<Grid>
<Grid.Background>
<RadialGradientBrush>
<GradientStop Color="#FFFFFFFF" Offset="0.00"/>
<GradientStop Color="#FFFF0000" Offset="0.25"/>
<GradientStop Color="#FFFFFF00" Offset="0.50"/>
<GradientStop Color="#FF00FF00" Offset="0.75"/>
<GradientStop Color="#FF0000FF" Offset="1.00"/>
</RadialGradientBrush>
</Grid.Background>
</Grid>
</Window>

5
Graficas por Computadora

<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication11"
mc:Ignorable="d"
Title="MainWindow" Height="350" Width="525">
<StackPanel>

<!-- This rectangle is painted with a radial gradient. -->


<Rectangle Height="326">
<Rectangle.Fill>
<RadialGradientBrush
GradientOrigin="0.5,0.5"
Center="0.5,0.5" RadiusX="0.5" RadiusY="0.5">
<RadialGradientBrush.GradientStops>
<GradientStop Color="Yellow" Offset="0" />
<GradientStop Color="Red" Offset="0.25" />
<GradientStop Color="Blue" Offset="0.75" />
<GradientStop Color="LimeGreen" Offset="1" />
</RadialGradientBrush.GradientStops>
</RadialGradientBrush>
</Rectangle.Fill>
</Rectangle>
</StackPanel>
</Window>

6
Graficas por Computadora

<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication12"
mc:Ignorable="d"
Title="DIBUJO GRADIENTE RADIAL" Height="500" Width="500">
<StackPanel>
<!--EJEMPLO DE: https://docs.microsoft.com/en-
us/dotnet/framework/wpf/graphics-multimedia/how-to-paint-an-area-with-a-radial-
gradient-->
<!-- EL RECTANGULO ES DIBUJADO CON GRADIENTE RADIAL -->
<Rectangle Width="500" Height="500">
<Rectangle.Fill>
<RadialGradientBrush
GradientOrigin="0.5,0.5"
Center="0.5,0.5" RadiusX="0.5" RadiusY="0.5">
<RadialGradientBrush.GradientStops>
<GradientStop Color="Yellow" Offset="0" />
<GradientStop Color="Red" Offset="0.25" />
<GradientStop Color="Blue" Offset="0.75" />
<GradientStop Color="LimeGreen" Offset="1" />
</RadialGradientBrush.GradientStops>
</RadialGradientBrush>
</Rectangle.Fill>
</Rectangle>
</StackPanel>
</Window>

7
Graficas por Computadora

<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication13"
mc:Ignorable="d"
Title="ELIPSE-GRADIENTE RADIAL" Height="566" Width="525"
WindowStartupLocation="CenterScreen">
<Grid>
<Ellipse Margin="5,16,5,-6" Stretch="Uniform">
<Ellipse.Fill>
<RadialGradientBrush>
<GradientStop Color="White" Offset="0"></GradientStop>
<GradientStop Color="Orange" Offset="1"></GradientStop>
</RadialGradientBrush>
</Ellipse.Fill>
</Ellipse>
</Grid>
</Window>

8
Graficas por Computadora

<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication14"
mc:Ignorable="d"
Title="ELIPSES GRADIENTE" Height="350" Width="350" Background="Azure" ResizeMode="NoResize"
WindowStartupLocation="CenterScreen">
<StackPanel>
<Rectangle Width="150" Height="150">
<Rectangle.Fill>
<RadialGradientBrush GradientOrigin="0.75,0.25">
<GradientStop Color="Yellow" Offset="0.0" />
<GradientStop Color="Orange" Offset="0.5" />
<GradientStop Color="Red" Offset="1.0" />
</RadialGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Ellipse Width="50" Height="50">
<Ellipse.Fill>
<RadialGradientBrush GradientOrigin="0.75,0.25">
<GradientStop Color="White" Offset="0.0" />
<GradientStop Color="MediumBlue" Offset="0.5" />
<GradientStop Color="Black" Offset="1.0" />
</RadialGradientBrush>
</Ellipse.Fill>
</Ellipse>
<Ellipse Width="50" Height="50">
<Ellipse.Fill>
<RadialGradientBrush GradientOrigin="0.75,0.25">
<GradientStop Color="AliceBlue" Offset="0.0" />
<GradientStop Color="Purple" Offset="0.5" />
<GradientStop Color="#330033" Offset="1.0" />
</RadialGradientBrush>
</Ellipse.Fill>
</Ellipse>
<Ellipse Width="50" Height="50">
<Ellipse.Fill>
<RadialGradientBrush GradientOrigin="0.75,0.25">
<GradientStop Color="Yellow" Offset="0.0" />
<GradientStop Color="Orange" Offset="0.5" />
<GradientStop Color="Red" Offset="1.0" />
</RadialGradientBrush>
</Ellipse.Fill>
</Ellipse>
</StackPanel>
</Window>

9
Graficas por Computadora

<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication15"
mc:Ignorable="d"
Title="MainWindow" Height="400" Width="400" ResizeMode="NoResize"
WindowStartupLocation="CenterScreen">
<!--TOMADO DEL SITIO:
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"-->
<Canvas Margin="0,0,2,0">

<Rectangle Name="rect"
Canvas.Left="96" Canvas.Top="96"
Width="192" Height="192"
Stroke="Black">
<Rectangle.Fill>
<LinearGradientBrush x:Name="brush">
<LinearGradientBrush.GradientStops>
<GradientStop Offset="0" Color="Red" />
<GradientStop Offset="1" Color="Blue" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>

<Canvas.Triggers>
<EventTrigger RoutedEvent="Canvas.Loaded">
<BeginStoryboard>
<Storyboard>

<PointAnimation Storyboard.TargetName="brush"
Storyboard.TargetProperty="StartPoint"
From="0 0" To="1 0" Duration="0:0:5"
AutoReverse="True"
RepeatBehavior="Forever" />

<PointAnimation Storyboard.TargetName="brush"
Storyboard.TargetProperty="EndPoint"
From="1 1" To="0 1" Duration="0:0:5"

10
Graficas por Computadora

AutoReverse="True"
RepeatBehavior="Forever" />

<ColorAnimation
Storyboard.TargetName="brush"
Storyboard.TargetProperty="GradientStops[0].Color"
From="Red" To="Blue" Duration="0:0:1"
AutoReverse="True"
RepeatBehavior="Forever" />

<ColorAnimation
Storyboard.TargetName="brush"
Storyboard.TargetProperty="GradientStops[1].Color"
From="Blue" To="Red" Duration="0:0:1"
AutoReverse="True"
RepeatBehavior="Forever" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Canvas.Triggers>
</Canvas>
</Window>

11

You might also like