System.Windows.Media 命名空间


.NET Framework 类库
GlyphRunDrawing 类

更新:2007 年 11 月

表示一个呈现 GlyphRunDrawing 对象。

命名空间:  System.Windows.Media
程序集:  PresentationCore(在 PresentationCore.dll 中)
用于 XAML 的 XMLNS:http://schemas.microsoft.com/winfx/xaml/presentation

语法

Visual Basic(声明)
Public NotInheritable Class GlyphRunDrawing _
    Inherits Drawing
Visual Basic (用法)
Dim instance As GlyphRunDrawing
C#
public sealed class GlyphRunDrawing : Drawing
Visual C++
public ref class GlyphRunDrawing sealed : public Drawing
J#
public final class GlyphRunDrawing extends Drawing
JScript
public final class GlyphRunDrawing extends Drawing
XAML 对象元素用法
<GlyphRunDrawing .../>
备注

GlyphRun 对象表示只具有一种大小和一种呈现样式的一种字体的一系列标志符号。

GlyphRun 包含诸如标志符号索引和个别标志符号位置之类的字体详细信息。此外,GlyphRun 包含从中生成运行的原始 Unicode 码位、字符到标志符号缓冲区偏移量的映射信息以及每个字符和每个标志符号标志。

GlyphRun 中的每个标志符号都定义了相应的规格,用于指定它与其他 Glyphs 的对齐方式。下图定义了两个不同标志符号字符的各种版式质量。

两个不同标志符号字符的各种版式质量

标志符号度量示意图

Freezable 功能:GlyphRunDrawing 是某种类型的 Freezable 对象,因此可以被冻结以提高性能。有关 Freezable 功能(例如冻结和克隆)的信息,请参见 Freezable 对象概述

警告:GlyphRunDrawing 对象不支持部分信任的执行。若要使用 GlyphRunDrawing 对象,应用程序必须具有完全信任权限。

示例

下面的示例使用 GlyphRunDrawing 来绘制文本“Hello World”。

C#
GlyphRun theGlyphRun = new GlyphRun(
    new GlyphTypeface(new Uri(@"C:\WINDOWS\Fonts\TIMES.TTF")),
    0,
    false,
    13.333333333333334,
    new ushort[]{43, 72, 79, 79, 82, 3, 58, 82, 85, 79, 71},
    new Point(0, 12.29),
    new double[]{
        9.62666666666667, 7.41333333333333, 2.96, 
        2.96, 7.41333333333333, 3.70666666666667, 
        12.5866666666667, 7.41333333333333, 
        4.44, 2.96, 7.41333333333333},
    null,
    null,
    null,
    null,
    null,
    null


    );

GlyphRunDrawing gDrawing = new GlyphRunDrawing(Brushes.Black, theGlyphRun);
XAML
<GlyphRunDrawing ForegroundBrush="Black">
  <GlyphRunDrawing.GlyphRun>
    <GlyphRun 
      CaretStops="{x:Null}" 
      ClusterMap="{x:Null}" 
      IsSideways="False" 
      GlyphOffsets="{x:Null}" 
      GlyphIndices="43 72 79 79 82 3 58 82 85 79 71" 
      BaselineOrigin="0,12.29"  
      FontRenderingEmSize="13.333333333333334" 
      DeviceFontName="{x:Null}" 
      AdvanceWidths="9.62666666666667 7.41333333333333 2.96 2.96 7.41333333333333 3.70666666666667 12.5866666666667 7.41333333333333 4.44 2.96 7.41333333333333" 
      BidiLevel="0">
      <GlyphRun.GlyphTypeface>
        <GlyphTypeface FontUri="C:\WINDOWS\Fonts\TIMES.TTF" />
      </GlyphRun.GlyphTypeface>
    </GlyphRun>
  </GlyphRunDrawing.GlyphRun>
</GlyphRunDrawing>

GlyphRun 是低级别的对象,拟用于固定格式的文档表示和打印方案。将文本绘制到屏幕上的一种比较简单的方法是使用 LabelTextBlock。有关 GlyphRun 的更多信息,请参见 GlyphRun 对象和 Glyphs 元素简介概述。

继承层次结构

System..::.Object
  System.Windows.Threading..::.DispatcherObject
    System.Windows..::.DependencyObject
      System.Windows..::.Freezable
        System.Windows.Media.Animation..::.Animatable
          System.Windows.Media..::.Drawing
            System.Windows.Media..::.GlyphRunDrawing
线程安全

此类型的任何公共 static(在 Visual Basic 中为 Shared) 成员都是线程安全的。但不保证所有实例成员都是线程安全的。
平台

Windows Vista

.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求

版本信息

.NET Framework

受以下版本支持:3.5、3.0
另请参见

参考

其他资源

标记 :


Page view tracker