Click here to Skip to main content
15,886,806 members
Articles / Desktop Programming / WPF

WPF Grand Prix

Rate me:
Please Sign up or sign in to vote.
4.97/5 (110 votes)
14 Dec 2010CPOL10 min read 382.9K   6.3K   176  
An article showing how to create a race game using the powerful WPF capabilities
<UserControl x:Class="F1.TrackSegments.TrackSWCorner"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="200" d:DesignWidth="200">
    <Grid>
        <Grid.RenderTransform>
            <TransformGroup>
                <ScaleTransform ScaleX="1.0" ScaleY="1.0"/>
            </TransformGroup>
        </Grid.RenderTransform>
        <Grid.Background>
            <ImageBrush ImageSource="../Images/Grass.png" ViewboxUnits="Absolute" TileMode="Tile"/>
        </Grid.Background>
        <Ellipse Width="400" Height="400" Margin="0,-200,0,0">
            <Ellipse.Fill>
                <RadialGradientBrush>
                    <GradientStop Offset="0.0" Color="#808080"/>
                    <GradientStop Offset="0.25" Color="#606060"/>
                    <GradientStop Offset="0.5" Color="#808080"/>
                    <GradientStop Offset="0.75" Color="#606060"/>
                    <GradientStop Offset="1.0" Color="#808080"/>
                </RadialGradientBrush>
            </Ellipse.Fill>
            <Ellipse.Clip>
                <RectangleGeometry Rect="0,200,200,200"/>
            </Ellipse.Clip>
        </Ellipse>
        <Rectangle Stroke="#C0C080" StrokeThickness="4" StrokeDashArray="3,2" StrokeDashOffset="0" Margin="100,-100,-100,100" RadiusX="100" RadiusY="100">
            <Rectangle.Clip>
                <RectangleGeometry Rect="0,100,100,200"/>
            </Rectangle.Clip>
        </Rectangle>
    </Grid>
</UserControl>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Instructor / Trainer Alura Cursos Online
Brazil Brazil

Comments and Discussions