Chronomètre en wpf

Description

Petit Chronomètre réalisé en WPF. En fait c'est la copie conforme de celui que j'ai en vrai!
Compilé avec Visual Studio 2008 et réalisé partiellement avec Expression Blend.

Source / Exemple :

/////////////////////////////////////////////////////////////////////////
// MyChono.cs
/////////////////////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Text;

namespace Chronometre
{

    public class MyChrono
    {
        int centiSeconds;
        int seconds;
        int minutes;
        int hours;
        DateTime dateStarted;
        DateTime datePaused;
        bool paused;
        private bool isLaunched;        // True when timer launched

        public MyChrono()
        {
            
            centiSeconds = 0;
            seconds = 0;
            minutes = 0;
            hours = 0;
            isLaunched = false;
            paused = false;
        }

        public void Start()
        {
            isLaunched = true;

            // If the chrono has been paused
            if (paused == true)
            {
                // Resume
                TimeSpan t = DateTime.Now.Subtract(datePaused);
                dateStarted = dateStarted.Add(t);
            }
            // Else : not been paused
            else
                dateStarted = DateTime.Now;

 
        }

        public void Stop()
        {
            isLaunched = false;
            datePaused = DateTime.Now;
            paused = true;
        }

        public void Reset()
        {
            isLaunched = false;
            paused = false;
            dateStarted = DateTime.Now;
            datePaused = DateTime.Now;

        }

        public bool isChronoLaunched
        {
            get  //get accessor method
            {
                return isLaunched;
            }
            
        }


        public override String ToString()
        {
   

            DateTime DateNow = DateTime.Now;
            TimeSpan Difference = DateNow - dateStarted;

            StringBuilder builder = new StringBuilder(11);
            builder.Append(Difference.Hours.ToString("d2"));
            builder.Append(":");
            builder.Append(Difference.Minutes.ToString("d2"));
            builder.Append(":");
            builder.Append(Difference.Seconds.ToString("d2"));
            builder.Append(":");
            builder.Append((Difference.Milliseconds.ToString("d2")).Substring(0,2));

            return builder.ToString();
        }

        public String Now()
        {
            DateTime dateNow = DateTime.Now;
            StringBuilder builder = new StringBuilder(8);
            builder.Append(dateNow.Hour.ToString("d2"));
            builder.Append(":");
            builder.Append(dateNow.Minute.ToString("d2"));
            builder.Append(":");
            builder.Append(dateNow.Second.ToString("d2"));

            return builder.ToString();
        }
    }
}
/////////////////////////////////////////////////////////////////////////
// Window1.xaml.cs
/////////////////////////////////////////////////////////////////////////


using System;
using System.IO;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Navigation;
using System.Windows.Threading;

namespace Chronometre
{
	public partial class Window1
	{
        enum Modes { timer, clock }
        int mode;       // Mode
        DispatcherTimer dispatcherTimer;
        DispatcherTimer clockTimer;
        MyChrono chrono;

		public Window1()
		{
			this.InitializeComponent();
			
			// Insert code required on object creation below this point.
            mode = (int)Modes.timer;

            // Setup the timer
            dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
            dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
            dispatcherTimer.Interval = new TimeSpan(0,0,0,0,10);

            clockTimer = new System.Windows.Threading.DispatcherTimer();
            clockTimer.Tick += new EventHandler(clockTimer_Tick);
            clockTimer.Interval = new TimeSpan(0, 0, 1);
            clockTimer.Start();


            chrono = new MyChrono();

		}

        private void clockTimer_Tick(object sender, EventArgs e)
        {
            lblClockDisplay.Content = chrono.Now();
        }

        // When the timer tick
        private void dispatcherTimer_Tick(object sender, EventArgs e)
        {
            lblTime.Content = chrono.ToString();

            

            


        }


        // When the mode button is clicked
        private void btnMode_Click(object sender, RoutedEventArgs e)
        {
            // Set all the mode's labels ton unvisible
            lblTimer.Visibility = Visibility.Hidden;
            lblPeacer.Visibility = Visibility.Hidden;
            lblClock.Visibility = Visibility.Hidden;
            
            

            lblTime.Visibility = Visibility.Hidden;
            lblPeacerDisplay.Visibility = Visibility.Hidden;
            lblClockDisplay.Visibility = Visibility.Hidden;

            // Increment
            mode++;
            mode = mode%2;

            // Set if the labels are visible or not
            Console.WriteLine("le mode : " + mode);
            if (mode == (int)Modes.timer)
            {
                lblTimer.Visibility = Visibility.Visible;
                lblTime.Visibility = Visibility.Visible;
            }
            /*else if (mode == (int)Modes.peacer)
            {
                lblPeacer.Visibility = Visibility.Visible;
                lblPeacerDisplay.Visibility = Visibility.Visible;
            }*/
            else if (mode == (int)Modes.clock)
            {
                lblClock.Visibility = Visibility.Visible;
                lblClockDisplay.Visibility = Visibility.Visible;
            }
        }

        private void BtnClose_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void BtnStartStop_Click(object sender, RoutedEventArgs e)
        {
            if (mode == (int)Modes.timer)
            {
                if (!chrono.isChronoLaunched)
                {

                    chrono.Start();
                    dispatcherTimer.Start();

                }
                else
                {
                    chrono.Stop();
                    dispatcherTimer.Stop();


                }
            }

        }

        private void BtnReset_Click(object sender, RoutedEventArgs e)
        {
            if (mode == (int)Modes.timer)
            {
                chrono.Stop();
                chrono.Reset();
                dispatcherTimer.Stop();
                lblTime.Content = "00:00:00:00";
            }
        }

        private void DragChrono(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            this.DragMove();
        }

 


	}
}

////////////////////////////////////////////////////////////////////////////////////////////
// Window1.xaml
////////////////////////////////////////////////////////////////////////////////////////////<Window
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	x:Class="Chronometre.Window1"
	x:Name="Window"
	Title="Chronomètre"
	Width="640" Height="480" AllowsTransparency="True" WindowStyle="None" Background="{x:Null}">

	<Window.Resources>
		<Storyboard x:Key="OnClick1"/>
		<Style x:Key="ButtonFocusVisual">
			<Setter Property="Control.Template">
				<Setter.Value>
					<ControlTemplate>
						<Rectangle SnapsToDevicePixels="true" Stroke="Black" StrokeDashArray="1 2" StrokeThickness="1" Margin="2"/>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<LinearGradientBrush x:Key="ButtonNormalBackground" EndPoint="0,1" StartPoint="0,0">
			<GradientStop Color="#F3F3F3" Offset="0"/>
			<GradientStop Color="#EBEBEB" Offset="0.5"/>
			<GradientStop Color="#DDDDDD" Offset="0.5"/>
			<GradientStop Color="#CDCDCD" Offset="1"/>
		</LinearGradientBrush>
		<SolidColorBrush x:Key="ButtonNormalBorder" Color="#FF707070"/>
		<Style x:Key="ButtonChrono" TargetType="{x:Type Button}">
			<Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
			<Setter Property="Background" Value="{StaticResource ButtonNormalBackground}"/>
			<Setter Property="BorderBrush" Value="{StaticResource ButtonNormalBorder}"/>
			<Setter Property="BorderThickness" Value="1"/>
			<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
			<Setter Property="HorizontalContentAlignment" Value="Center"/>
			<Setter Property="VerticalContentAlignment" Value="Center"/>
			<Setter Property="Padding" Value="1"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type Button}">
						<ControlTemplate.Resources>
							<Storyboard x:Key="OnClick1">
								<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
									<SplineColorKeyFrame KeyTime="00:00:00" Value="#FFE38E19"/>
									<SplineColorKeyFrame KeyTime="00:00:00.3000000" Value="sc#1, 0.283148736, 0.768151164, 0.009721218"/>
									<SplineColorKeyFrame KeyTime="00:00:01" Value="#FFE38E19"/>
								</ColorAnimationUsingKeyFrames>
								<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
									<SplineColorKeyFrame KeyTime="00:00:00" Value="#FFFFD06C"/>
									<SplineColorKeyFrame KeyTime="00:00:00.3000000" Value="sc#1, 0.806952238, 0.9559733, 0.610495567"/>
									<SplineColorKeyFrame KeyTime="00:00:01" Value="#FFFFD06C"/>
								</ColorAnimationUsingKeyFrames>
								<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)">
									<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
									<SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="4"/>
									<SplineDoubleKeyFrame KeyTime="00:00:01" Value="0"/>
								</DoubleAnimationUsingKeyFrames>
								<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" RepeatBehavior="1x" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Offset)" Storyboard.TargetName="ellipse">
									<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
									<SplineDoubleKeyFrame KeyTime="00:00:01" Value="0"/>
								</DoubleAnimationUsingKeyFrames>
								<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Offset)" Storyboard.TargetName="ellipse">
									<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
									<SplineDoubleKeyFrame KeyTime="00:00:01" Value="1"/>
								</DoubleAnimationUsingKeyFrames>
							</Storyboard>
							<Storyboard x:Key="clignote">
								<ColorAnimationUsingKeyFrames BeginTime="00:00:00" RepeatBehavior="Forever" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">
									<SplineColorKeyFrame KeyTime="00:00:00" Value="#FF000000"/>
									<SplineColorKeyFrame KeyTime="00:00:01" Value="#FF39FF00"/>
									<SplineColorKeyFrame KeyTime="00:00:02" Value="#FF000000"/>
								</ColorAnimationUsingKeyFrames>
								<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" RepeatBehavior="Forever" Storyboard.TargetName="ellipse" Storyboard.TargetProperty="(Shape.StrokeThickness)">
									<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
									<SplineDoubleKeyFrame KeyTime="00:00:01" Value="2"/>
									<SplineDoubleKeyFrame KeyTime="00:00:02" Value="1"/>
								</DoubleAnimationUsingKeyFrames>
							</Storyboard>
						</ControlTemplate.Resources>
						<Grid Width="67.5" Height="44">
							<Ellipse RenderTransformOrigin="0.5,0.5" Stroke="#FF000000" Margin="0,0,0,0" x:Name="ellipse">
								<Ellipse.RenderTransform>
									<TransformGroup>
										<ScaleTransform ScaleX="1" ScaleY="1"/>
										<SkewTransform AngleX="0" AngleY="0"/>
										<RotateTransform Angle="0"/>
										<TranslateTransform X="0" Y="0"/>
									</TransformGroup>
								</Ellipse.RenderTransform>
								<Ellipse.Fill>
									<RadialGradientBrush>
										<GradientStop Color="#FFFFD06C" Offset="0"/>
										<GradientStop Color="#FFE38E19" Offset="1"/>
									</RadialGradientBrush>
								</Ellipse.Fill>
							</Ellipse>
						</Grid>
						<ControlTemplate.Triggers>
							<Trigger Property="IsMouseOver" Value="True">
								<Trigger.EnterActions>
									<BeginStoryboard x:Name="clignote_BeginStoryboard" Storyboard="{StaticResource clignote}"/>
								</Trigger.EnterActions>
								<Trigger.ExitActions>
									<StopStoryboard BeginStoryboardName="clignote_BeginStoryboard"/>
								</Trigger.ExitActions>
							</Trigger>
							<EventTrigger RoutedEvent="FrameworkElement.Loaded"/>
							<Trigger Property="IsKeyboardFocused" Value="true"/>
							<Trigger Property="ToggleButton.IsChecked" Value="true"/>
							<Trigger Property="IsEnabled" Value="false">
								<Setter Property="Foreground" Value="#ADADAD"/>
							</Trigger>
							<Trigger Property="IsPressed" Value="True">
								<Trigger.EnterActions>
									<BeginStoryboard x:Name="OnClick1_BeginStoryboard" Storyboard="{StaticResource OnClick1}"/>
								</Trigger.EnterActions>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Style x:Key="ModeButton" TargetType="{x:Type Button}">
			<Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
			<Setter Property="Background" Value="{StaticResource ButtonNormalBackground}"/>
			<Setter Property="BorderBrush" Value="{StaticResource ButtonNormalBorder}"/>
			<Setter Property="BorderThickness" Value="1"/>
			<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
			<Setter Property="HorizontalContentAlignment" Value="Center"/>
			<Setter Property="VerticalContentAlignment" Value="Center"/>
			<Setter Property="Padding" Value="1"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type Button}">
						<ControlTemplate.Resources>
							<Storyboard x:Key="Timeline1">
								<ColorAnimationUsingKeyFrames BeginTime="00:00:00" RepeatBehavior="Forever" Storyboard.TargetName="path" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">
									<SplineColorKeyFrame KeyTime="00:00:00" Value="#FF000000"/>
									<SplineColorKeyFrame KeyTime="00:00:01" Value="#FF39FF00"/>
									<SplineColorKeyFrame KeyTime="00:00:02" Value="#FF000000"/>
								</ColorAnimationUsingKeyFrames>
							</Storyboard>
							<Storyboard x:Key="OnClick">
								<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="path" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
									<SplineColorKeyFrame KeyTime="00:00:00" Value="#FFE38E19"/>
									<SplineColorKeyFrame KeyTime="00:00:00.2000000" Value="#FF91E319"/>
									<SplineColorKeyFrame KeyTime="00:00:01" Value="#FFE38E19"/>
								</ColorAnimationUsingKeyFrames>
								<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="path" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Offset)">
									<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
									<SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="1"/>
									<SplineDoubleKeyFrame KeyTime="00:00:01" Value="1"/>
								</DoubleAnimationUsingKeyFrames>
								<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="path" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Offset)">
									<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
									<SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="0"/>
									<SplineDoubleKeyFrame KeyTime="00:00:01" Value="0"/>
								</DoubleAnimationUsingKeyFrames>
								<ColorAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="path" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
									<SplineColorKeyFrame KeyTime="00:00:00" Value="#FFFFD06C"/>
									<SplineColorKeyFrame KeyTime="00:00:00.2000000" Value="#FFFFF76C"/>
									<SplineColorKeyFrame KeyTime="00:00:01" Value="#FFFFD06C"/>
								</ColorAnimationUsingKeyFrames>
							</Storyboard>
						</ControlTemplate.Resources>
						<Grid>
							<Path Stretch="Fill" Stroke="#FF000000" Margin="1.768,-2.49,2.261,-0.5" x:Name="path" VerticalAlignment="Stretch" Height="Auto" Data="M7.667056,-0.16723592 L54.331773,-0.16778772 C54.331773,-0.16778772 57.331558,0.4993614 63.331674,-1.8343669 69.451225,-4.2145487 59.332635,21.171333 53.999371,23.838667 48.666107,26.506 34.66602,27.1732 28.666148,23.17216 28.666148,23.17216 14.33354,16.170131 6.333711,9.1683588 6.333711,9.1683588 1.6667451,7.1679536 2.3333975,2.8335234 3.00005,-1.5009067 7.667056,-0.16723592 7.667056,-0.16723592 z">
								<Path.Fill>
									<RadialGradientBrush>
										<GradientStop Color="#FFFFD06C" Offset="0"/>
										<GradientStop Color="#FFE38E19" Offset="1"/>
									</RadialGradientBrush>
								</Path.Fill>
							</Path>
						</Grid>
						<ControlTemplate.Triggers>
							<Trigger Property="IsMouseOver" Value="True">
								<Trigger.EnterActions>
									<BeginStoryboard x:Name="Timeline1_BeginStoryboard" Storyboard="{StaticResource Timeline1}"/>
								</Trigger.EnterActions>
								<Trigger.ExitActions>
									<StopStoryboard BeginStoryboardName="Timeline1_BeginStoryboard"/>
								</Trigger.ExitActions>
							</Trigger>
							<Trigger Property="IsKeyboardFocused" Value="true"/>
							<Trigger Property="ToggleButton.IsChecked" Value="true"/>
							<Trigger Property="IsEnabled" Value="false">
								<Setter Property="Foreground" Value="#ADADAD"/>
							</Trigger>
							<Trigger Property="IsPressed" Value="True">
								<Trigger.EnterActions>
									<BeginStoryboard x:Name="OnClick_BeginStoryboard" Storyboard="{StaticResource OnClick}"/>
								</Trigger.EnterActions>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<FontFamily x:Key="FontChrono">Humnst777 Lt BT</FontFamily>
	</Window.Resources>
	<Window.Triggers>
		<EventTrigger RoutedEvent="ButtonBase.Click" SourceName="BtnStop"/>
		<EventTrigger RoutedEvent="ButtonBase.Click" SourceName="BtnReset"/>
		<EventTrigger RoutedEvent="ButtonBase.Click" SourceName="btnMode"/>
		<EventTrigger RoutedEvent="ButtonBase.Click" SourceName="BtnClose"/>
	</Window.Triggers>
	<Grid>
		<Button RenderTransformOrigin="0.5,0.5" x:Name="BtnStop" Style="{DynamicResource ButtonChrono}" Height="43.305" Content="Button" HorizontalAlignment="Right" Margin="0,59.705,169.111,0" VerticalAlignment="Top" Width="72.451" Click="BtnStartStop_Click">
			<Button.RenderTransform>
				<TransformGroup>
					<ScaleTransform ScaleX="1" ScaleY="1"/>
					<SkewTransform AngleX="0" AngleY="0"/>
					<RotateTransform Angle="44.745"/>
					<TranslateTransform X="0" Y="0"/>
				</TransformGroup>
			</Button.RenderTransform>
		</Button>
		<Button RenderTransformOrigin="0.5,0.5" x:Name="BtnClose" Style="{DynamicResource ButtonChrono}" Height="43.305" Content="Button" Margin="274.438,19.038,293.111,0" VerticalAlignment="Top" Click="BtnClose_Click">
			<Button.RenderTransform>
				<TransformGroup>
					<ScaleTransform ScaleX="1" ScaleY="1"/>
					<SkewTransform AngleX="0" AngleY="0"/>
					<RotateTransform Angle="0"/>
					<TranslateTransform X="0" Y="0"/>
				</TransformGroup>
			</Button.RenderTransform>
		</Button>
		<Button RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Left" Margin="146.437,61.705,0,0" x:Name="BtnReset" Style="{DynamicResource ButtonChrono}" VerticalAlignment="Top" Width="72.451" Height="43.305" Content="Button" Click="BtnReset_Click">
			<Button.RenderTransform>
				<TransformGroup>
					<ScaleTransform ScaleX="1" ScaleY="1"/>
					<SkewTransform AngleX="0" AngleY="0"/>
					<RotateTransform Angle="-46.887"/>
					<TranslateTransform X="0" Y="0"/>
				</TransformGroup>
			</Button.RenderTransform>
		</Button>
		<Path Stretch="Fill" Stroke="#FF000000" Margin="134.797,36.574,156.323,8" x:Name="Coque" Data="F1 M171.953,376.332 C161.04538,376.332 152.203,385.17438 152.203,396.082 152.203,406.98962 161.04538,415.832 171.953,415.832 182.86063,415.832 191.703,406.98962 191.703,396.082 191.703,385.17438 182.86063,376.332 171.953,376.332 z M160.8188,0.51317179 C172.70158,0.65379781 178.703,0.83199362 178.703,0.83199372 178.891,0.81008102 289.82605,-10.859599 330.06485,89.443733 369.20163,186.99997 333.44241,336.59485 333.44241,336.59485 323.12469,362.75375 305.88052,431.35153 180.58833,434.17569 33.588947,444.67569 15.349137,325.70868 15.349136,325.70868 15.286747,325.48871 -20.762596,198.27933 19.702114,90.372581 50.076893,9.372551 125.17045,0.091297753 160.8188,0.51317179 z">
			<Path.Fill>
				<RadialGradientBrush>
					<GradientStop Color="#FF827A7A" Offset="1"/>
					<GradientStop Color="#FFF0F0F0" Offset="0.024"/>
				</RadialGradientBrush>
			</Path.Fill>
		</Path>
		<Path Stretch="Fill" Stroke="#FF000000" Margin="164.582,73.99,185.867,176.5" x:Name="TourGeonaute" Data="M220.5,300 L406.5,301.5 C406.5,301.5 444.00038,300 444.00038,265.5 444.00038,231 448.5,219 433.5,159 418.5,99 307.31189,106.98749 307.31189,106.98749 307.31189,106.98749 214.49999,99.000432 194.99996,151.50032 175.49992,204.00021 182.99975,267 182.99975,267 182.99975,267 187.50008,300 220.5,300 z">
			<Path.Fill>
				<LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
					<GradientStop Color="#FFECD27F" Offset="0.986"/>
					<GradientStop Color="#FFE38B14" Offset="0"/>
				</LinearGradientBrush>
			</Path.Fill>
		</Path>
		<Button HorizontalAlignment="Right" Margin="0,0,207.667,146.5" Style="{DynamicResource ModeButton}" VerticalAlignment="Bottom" Width="68" Height="26" Content="Button" x:Name="btnMode" Click="btnMode_Click" />
		<TextBlock RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Left" Margin="163.414,79.927,0,0" x:Name="txtReset" VerticalAlignment="Top" Width="57" Height="21.53" Text="reset" TextAlignment="Center" TextWrapping="Wrap">
			<TextBlock.RenderTransform>
				<TransformGroup>
					<ScaleTransform ScaleX="1" ScaleY="1"/>
					<SkewTransform AngleX="0" AngleY="0"/>
					<RotateTransform Angle="-48.444"/>
					<TranslateTransform X="0" Y="0"/>
				</TransformGroup>
			</TextBlock.RenderTransform>
		</TextBlock>
		<TextBlock RenderTransformOrigin="0.5,0.5" x:Name="txtClose" Height="21.53" Text="close" TextAlignment="Center" TextWrapping="Wrap" Margin="281.414,40.927,301.586,0" VerticalAlignment="Top">
			<TextBlock.RenderTransform>
				<TransformGroup>
					<ScaleTransform ScaleX="1" ScaleY="1"/>
					<SkewTransform AngleX="0" AngleY="0"/>
					<RotateTransform Angle="0"/>
					<TranslateTransform X="0" Y="0"/>
				</TransformGroup>
			</TextBlock.RenderTransform>
		</TextBlock>
		<TextBlock RenderTransformOrigin="0.5,0.5" x:Name="txtStart" Width="57" Height="21.53" Text="start | stop" TextAlignment="Center" TextWrapping="Wrap" HorizontalAlignment="Right" Margin="0,79.927,188.586,0" VerticalAlignment="Top">
			<TextBlock.RenderTransform>
				<TransformGroup>
					<ScaleTransform ScaleX="1" ScaleY="1"/>
					<SkewTransform AngleX="0" AngleY="0"/>
					<RotateTransform Angle="44.312"/>
					<TranslateTransform X="0" Y="0"/>
				</TransformGroup>
			</TextBlock.RenderTransform>
		</TextBlock>
		<Rectangle Fill="#FFFFFFFF" Stroke="#FF000000" RadiusX="6.5" RadiusY="6.5" Margin="194,139,220,223"/>
		<Grid Margin="194,139,220,223">
			<Label Margin="8,8,8,16" Content="00:00:00:00" FontFamily="{DynamicResource FontChrono}" FontSize="36" FontWeight="Normal" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Name="lblTime" />
            <Label Margin="8,8,8,16" Content="30" FontFamily="{DynamicResource FontChrono}" FontSize="36" FontWeight="Normal" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Name="lblPeacerDisplay" Visibility="Hidden" />
            <Label Margin="8,8,8,16" Content="00:00:00" FontFamily="{DynamicResource FontChrono}" FontSize="36" FontWeight="Normal" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Name="lblClockDisplay" Visibility="Hidden" />
            <Label HorizontalAlignment="Left" Margin="34.664,0,0,-5.332" x:Name="lblTimer" VerticalAlignment="Bottom" Width="37.333" Height="25.334" Content="TIMER" FontFamily="{DynamicResource FontChrono}" FontSize="8"/>
			<Label x:Name="lblPeacer" Height="25.334" Content="PEACER" FontFamily="{DynamicResource FontChrono}" FontSize="8" Visibility="Hidden" Margin="89.997,0,98.67,-5.332" VerticalAlignment="Bottom"/>
			<Label x:Name="lblClock" Height="25.334" Content="CLOCK" FontFamily="{DynamicResource FontChrono}" FontSize="8" Visibility="Hidden" HorizontalAlignment="Right" Margin="0,0,40.004,-5.332" VerticalAlignment="Bottom" Width="37.333"/>
		</Grid>
		<TextBlock RenderTransformOrigin="0.5,0.5" x:Name="lblMode" Text="mode" TextAlignment="Center" TextWrapping="Wrap" HorizontalAlignment="Right" Margin="0,0,240.667,172.5" VerticalAlignment="Bottom" Width="35" Height="21.53" Foreground="#FF615C5C">
			<TextBlock.RenderTransform>
				<TransformGroup>
					<ScaleTransform ScaleX="1" ScaleY="1"/>
					<SkewTransform AngleX="0" AngleY="0"/>
					<RotateTransform Angle="0"/>
					<TranslateTransform X="0" Y="0"/>
				</TransformGroup>
			</TextBlock.RenderTransform>
		</TextBlock>
		<Path Fill="#FF827A7A" Stretch="Fill" Stroke="{x:Null}" HorizontalAlignment="Right" Margin="0,0,231.833,180.833" VerticalAlignment="Bottom" Width="7.334" Height="6" Data="M401.33333,294 L407.66701,293.66667 404.66684,298.67148 z"/>
		<Label Margin="193.998,92,226.002,0" VerticalAlignment="Top" Height="43" Content="Chronomètre" FontFamily="{DynamicResource FontChrono}" FontSize="24" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"/>
		<Grid Margin="248.666,0,273.333,84.667" VerticalAlignment="Bottom" Height="43.333">
			<Label HorizontalAlignment="Left" Margin="8,15.333,0,8" x:Name="lblModele" Width="27.334" Content="mtd" FontFamily="{DynamicResource FontChrono}" FontSize="10"/>
			<Label Margin="28.667,14,32.001,1.333" x:Name="lblModele2" Content="5 O O" FontFamily="{DynamicResource FontChrono}" FontSize="18"/>
			<Ellipse Fill="{x:Null}" Stroke="#FFE38E19" StrokeThickness="3" Margin="45.334,20,52.667,3.333" x:Name="ellPetitChrono"/>
			<Ellipse Fill="#FFE38E19" Stroke="#FFE38E19" StrokeThickness="3" HorizontalAlignment="Left" Margin="44.498,21.499,0,17.667" Width="4.333"/>
			<Ellipse Fill="#FFE38E19" Stroke="#FFE38E19" StrokeThickness="3" Width="4.333" HorizontalAlignment="Left" Margin="52.831,17.499,0,0" VerticalAlignment="Top" Height="4.167"/>
			<Ellipse Fill="#FFE38E19" Stroke="#FFE38E19" StrokeThickness="3" HorizontalAlignment="Right" Margin="0,21.499,52.504,17.667" Width="4.333"/>
		</Grid>
	</Grid>
</Window>

Conclusion :

Le bouton fermer se situe en haut du Chronomètre

Codes Sources

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.