Converting text to geometry : Geometry « Windows Presentation Foundation « VB.Net






Converting text to geometry

Converting text to geometry
       
<Window x:Class="GlyphExamples.GlyphClipping"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Glyph Clipping" Height="300" Width="300">
    <Grid HorizontalAlignment="Center" VerticalAlignment="Center" Width="64">
      <Grid.LayoutTransform>
        <ScaleTransform ScaleX="4" ScaleY="4" />
      </Grid.LayoutTransform>
      <Button x:Name="button1" Content="Click" />
    </Grid>
</Window>

//File:Window.xaml.vb
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Imaging
Imports System.Windows.Shapes
Imports System.Threading

Namespace GlyphExamples
  Public Partial Class GlyphClipping
    Inherits System.Windows.Window
    Public Sub New()
      InitializeComponent()
      Dim text As New FormattedText("CLIP!", Thread.CurrentThread.CurrentUICulture, FlowDirection.LeftToRight, New Typeface("Gill Sans Ultra Bold"), 20, Brushes.Black)

      Dim textGeometry As Geometry = text.BuildGeometry(New Point(0, 0))
      button1.Clip = textGeometry
    End Sub
  End Class
End Namespace

   
    
    
    
    
    
    
  








Related examples in the same category

1.GeometryCombineMode = UnionGeometryCombineMode = Union
2.GeometryCombineMode = IntersectGeometryCombineMode = Intersect
3.GeometryCombineMode = XorGeometryCombineMode = Xor
4.GeometryCombineMode = ExcludeGeometryCombineMode = Exclude
5.Combine two circles into one shape using CombinedGeometry: UnionCombine two circles into one shape using CombinedGeometry: Union
6.Combine two circles into one shape using CombinedGeometry: XorCombine two circles into one shape using CombinedGeometry: Xor
7.Combine two circles into one shape using CombinedGeometry: IntersectCombine two circles into one shape using CombinedGeometry: Intersect
8.Combine two circles into one shape using CombinedGeometry: ExcludeCombine two circles into one shape using CombinedGeometry: Exclude
9.Combine GeometryCombine Geometry
10.LineGeometry for PathLineGeometry for Path
11.EllipseGeometry for PathEllipseGeometry for Path
12.BezierSegment for a PathBezierSegment for a Path
13.Put EllipseGeometry to GeometryGroupPut EllipseGeometry to GeometryGroup
14.Put RectangleGeometry to GeometryGroupPut RectangleGeometry to GeometryGroup
15.Path based on GeometryGroup ResourcePath based on GeometryGroup Resource
16.GeometryDrawing.BrushGeometryDrawing.Brush
17.GeometryDrawing.PenGeometryDrawing.Pen
18.GeometryDrawing with 2 PathFiguresGeometryDrawing with 2 PathFigures
19.GeometryGroup and DrawingImageGeometryGroup and DrawingImage
20.GeometryDrawing insize a DrawingGroupGeometryDrawing insize a DrawingGroup
21.Use the StreamGeometry mini-language to create polylineUse the StreamGeometry mini-language to create polyline
22.Create a PathGeometry using the PathFigureCollection mini-language.Create a PathGeometry using the PathFigureCollection mini-language.
23.PolyLineSegment creates a series of straight lines.PolyLineSegment creates a series of straight lines.
24.LineGeometry vs LineLineGeometry vs Line
25.RectangleGeometry vs RectangleRectangleGeometry vs Rectangle
26.EllipseGeometry vs Ellipse
27.Combine geometries is to use the GeometryGroup objectCombine geometries is to use the GeometryGroup object
28.Geometry GroupGeometry Group
29.GeometryDrawing Pen and GeometryGeometryDrawing Pen and Geometry
30.CombinedGeometry GeometryCombineMode="Union"CombinedGeometry GeometryCombineMode=
31.Reusing GeometryReusing Geometry
32.Use a PathGeometry object to highlight displayed text.Use a PathGeometry object to highlight displayed text.