Path with Shadow : Path « Windows Presentation Foundation « C# / CSharp Tutorial

Home
C# / CSharp Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statement
5.String
6.struct
7.Class
8.Operator Overload
9.delegate
10.Attribute
11.Data Structure
12.Assembly
13.Date Time
14.Development
15.File Directory Stream
16.Preprocessing Directives
17.Regular Expression
18.Generic
19.Reflection
20.Thread
21.I18N Internationalization
22.LINQ
23.GUI Windows Forms
24.Windows Presentation Foundation
25.Windows Communication Foundation
26.Workflow
27.2D
28.Design Patterns
29.Windows
30.XML
31.XML LINQ
32.ADO.Net
33.Network
34.Directory Services
35.Security
36.unsafe
C# / C Sharp
C# / C Sharp by API
C# / CSharp Open Source
C# / CSharp Tutorial » Windows Presentation Foundation » Path 
24.87.46.Path with Shadow
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:src="clr-namespace:MyNameSpace.TextGeometryDemo" 
        Title="TextGeometry Demo">
    <Window.Resources>
        <src:TextGeometry x:Key="txtHollow" Text="Hollow"
                          FontFamily="Times New Roman" 
                          FontSize="192" FontWeight="Bold" />
        
        <src:TextGeometry x:Key="txtShadow" Text="Shadow"
                          FontFamily="Times New Roman"
                          FontSize="192" FontWeight="Bold" />
    </Window.Resources>

    <TabControl>
        <TabItem Header="Shadow">
            <Canvas>
                <Path Fill="DarkGray"
                      Data="{Binding Source={StaticResource txtShadow},Path=Geometry}"
                      Canvas.Left="12" Canvas.Top="12" />
                <Path Stroke="Black" Fill="White" 
                      Data="{Binding Source={StaticResource txtShadow},Path=Geometry}" />
            </Canvas>
        </TabItem>


    </TabControl>
</Window>
//File:Window.xaml.cs
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Media;

namespace MyNameSpace.TextGeometryDemo
{
    public class TextGeometry
    {
        string txt = "";
        FontFamily fntfam = new FontFamily();
        FontStyle fntstyle = FontStyles.Normal;
        FontWeight fntwt = FontWeights.Normal;
        FontStretch fntstr = FontStretches.Normal;
        double emsize = 24;
        Point ptOrigin = new Point(00);

        public string Text
        {
            set txt = value; }
            get return txt; }
        }
        public FontFamily FontFamily
        {
            set fntfam = value; }
            get return fntfam; }
        }
        public FontStyle FontStyle
        {
            set fntstyle = value; }
            get return fntstyle; }
        }
        public FontWeight FontWeight
        {
            set fntwt = value; }
            get return fntwt; }
        }
        public FontStretch FontStretch
        {
            set fntstr = value; }
            get return fntstr; }
        }
        public double FontSize
        {
            set emsize = value; }
            get return emsize; }
        }
        public Point Origin
        {
            set ptOrigin = value; }
            get return ptOrigin; }
        }

        public Geometry Geometry
        {
            get
            {
                FormattedText formtxt = new FormattedText(Text, CultureInfo.CurrentCulture, 
                                      FlowDirection.LeftToRight,
                                      new Typeface(FontFamily, FontStyle,FontWeight, FontStretch)
                                      FontSize, Brushes.Black);

                return formtxt.BuildGeometry(Origin);
            }
        }

        public PathGeometry PathGeometry
        {
            get
            {
                return PathGeometry.CreateFromGeometry(Geometry);
            }
        }

    }
}
WPF Path With Shadow
24.87.Path
24.87.1.Multiple Subpaths with PathFigureMultiple Subpaths with PathFigure
24.87.2.Close Path Command with PathFigureClose Path Command with PathFigure
24.87.3.Drawn with a Path Shape with GeometryDrawn with a Path Shape with Geometry
24.87.4.Vertical LineVertical Line
24.87.5.Horizontal LineHorizontal Line
24.87.6.Cubic Bezier Curve with BezierSegmentCubic Bezier Curve with BezierSegment
24.87.7.Line with PathGeometryLine with PathGeometry
24.87.8.Elliptical ArcElliptical Arc
24.87.9.Quadratic Bezier Curve with PathFigureQuadratic Bezier Curve with PathFigure
24.87.10.Creates a composite shape from three geometries. This GeometryGroup has a FillRule of NonZeroCreates a composite shape from three geometries. This GeometryGroup has a FillRule of NonZero
24.87.11.Creates a composite shape from three geometriesCreates a composite shape from three geometries
24.87.12.Multiple SubpathsMultiple Subpaths
24.87.13.Close Path CommandClose Path Command
24.87.14.Elliptical Arc PathElliptical Arc Path
24.87.15.Vertical Line with PathVertical Line with Path
24.87.16.Horizontal Line with PathHorizontal Line with Path
24.87.17.Line with PathLine with Path
24.87.18.Combines two geometries using the intersect combine modeCombines two geometries using the intersect combine mode
24.87.19.Transform Path defined in ResourceTransform Path defined in Resource
24.87.20.Difference between CounterClockwise and ClockwiseDifference between CounterClockwise and Clockwise
24.87.21.Path gradient and BezierPath gradient and Bezier
24.87.22.Path Angle Animated ButtonPath Angle Animated Button
24.87.23.Path Animated ButtonPath Animated Button
24.87.24.Squaring The CircleSquaring The Circle
24.87.25.Single BezierSingle Bezier
24.87.26.Overlapping StarsOverlapping Stars
24.87.27.Path Mini LanguagePath Mini Language
24.87.28.Overlapping RectanglesOverlapping Rectangles
24.87.29.Multiple Line SegmentsMultiple Line Segments
24.87.30.Figure With ArcsFigure With Arcs
24.87.31.Counterclockwise (default), small arc (default)Counterclockwise (default), small arc (default)
24.87.32.Counterclockwise (default), IsLargeArcCounterclockwise (default), IsLargeArc
24.87.33.Clockwise, small arc (default)Clockwise, small arc (default)
24.87.34.Clockwise, IsLargeArcClockwise, IsLargeArc
24.87.35.Eclipse SunEclipse Sun
24.87.36.Mini Language InfinityMini Language Infinity
24.87.37.Large ArcSegmentsLarge ArcSegments
24.87.38.Small ArcSegmentSmall ArcSegment
24.87.39.Bezier Curve with BezierSegmentBezier Curve with BezierSegment
24.87.40.PolyBezierSegment DemoPolyBezierSegment Demo
24.87.41.Multiple geometriesMultiple geometries
24.87.42.Combined geometries GeometryCombineMode=ExcludeCombined geometries GeometryCombineMode=Exclude
24.87.43.Path.Data with LineSegmentPath.Data with LineSegment
24.87.44.Path Margin as resourcePath Margin as resource
24.87.45.Shorthand Path dataShorthand Path data
24.87.46.Path with ShadowPath with Shadow
24.87.47.Discrete Point JumpsDiscrete Point Jumps
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.