当前位置: 首页>>代码示例>>C#>>正文


C# XPoint.ToPointF方法代码示例

本文整理汇总了C#中PdfSharp.Drawing.XPoint.ToPointF方法的典型用法代码示例。如果您正苦于以下问题:C# XPoint.ToPointF方法的具体用法?C# XPoint.ToPointF怎么用?C# XPoint.ToPointF使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PdfSharp.Drawing.XPoint的用法示例。


在下文中一共展示了XPoint.ToPointF方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddString

 /// <summary>
 /// Adds a text string to this path.
 /// </summary>
 public void AddString(string s, XFontFamily family, XFontStyle style, double emSize, XPoint origin, XStringFormat format)
 {
   this.gdipPath.AddString(s, family.family, (int)style, (float)emSize, origin.ToPointF(), format.RealizeGdiStringFormat());
 }
开发者ID:BackupTheBerlios,项目名称:zp7-svn,代码行数:7,代码来源:XGraphicsPath.cs

示例2: AddBezier

 /// <summary>
 /// Adds a cubic Bézier curve to the current figure.
 /// </summary>
 public void AddBezier(XPoint pt1, XPoint pt2, XPoint pt3, XPoint pt4)
 {
   this.items.Add(new XGraphicsPathItem(XGraphicsPathItemType.Beziers,
     new XPoint(pt1.X, pt1.Y), new XPoint(pt2.X, pt2.Y), new XPoint(pt3.X, pt3.Y), new XPoint(pt4.X, pt4.Y)));
   this.dirty = true;
   this.gdipPath.AddBezier(pt1.ToPointF(), pt2.ToPointF(), pt3.ToPointF(), pt4.ToPointF());
 }
开发者ID:BackupTheBerlios,项目名称:zp7-svn,代码行数:10,代码来源:XGraphicsPath.cs

示例3: AddString

        /// <summary>
        /// Adds a text string to this path.
        /// </summary>
        public void AddString(string s, XFontFamily family, XFontStyle style, double emSize, XPoint origin,
            XStringFormat format)
        {
            try
            {
#if CORE
                DiagnosticsHelper.HandleNotImplemented("XGraphicsPath.AddString");
#endif
#if GDI
                if (family.GdiFamily == null)
                    throw new NotFiniteNumberException(PSSR.NotImplementedForFontsRetrievedWithFontResolver(family.Name));

                PointF p = origin.ToPointF();
                p.Y += SimulateBaselineOffset(family, style, emSize, format);

                try
                {
                    Lock.EnterGdiPlus();
                    _gdipPath.AddString(s, family.GdiFamily, (int)style, (float)emSize, p, format.RealizeGdiStringFormat());
                }
                finally { Lock.ExitGdiPlus(); }
#endif
#if WPF
                if (family.WpfFamily == null)
                    throw new NotFiniteNumberException(PSSR.NotImplementedForFontsRetrievedWithFontResolver(family.Name));
#if !SILVERLIGHT
                XFont font = new XFont(family.Name, emSize, style);

                double x = origin.X;
                double y = origin.Y;

                double lineSpace = font.GetHeight();
                double cyAscent = lineSpace * font.CellAscent / font.CellSpace;
                double cyDescent = lineSpace * font.CellDescent / font.CellSpace;

                Typeface typeface = FontHelper.CreateTypeface(family.WpfFamily, style);
                FormattedText formattedText = FontHelper.CreateFormattedText(s, typeface, emSize, WpfBrushes.Black);

                switch (format.Alignment)
                {
                    case XStringAlignment.Near:
                        // nothing to do, this is the default
                        //formattedText.TextAlignment = TextAlignment.Left;
                        break;

                    case XStringAlignment.Center:
                        formattedText.TextAlignment = TextAlignment.Center;
                        break;

                    case XStringAlignment.Far:
                        formattedText.TextAlignment = TextAlignment.Right;
                        break;
                }
                switch (format.LineAlignment)
                {
                    case XLineAlignment.Near:
                        //y += cyAscent;
                        break;

                    case XLineAlignment.Center:
                        // TODO use CapHeight. PDFlib also uses 3/4 of ascent
                        y += -lineSpace / 2; //-formattedText.Baseline + (cyAscent * 2 / 4);
                        break;

                    case XLineAlignment.Far:
                        y += -formattedText.Baseline - cyDescent;
                        break;

                    case XLineAlignment.BaseLine:
                        y -= formattedText.Baseline;
                        break;
                }

                Geometry geo = formattedText.BuildGeometry(new XPoint(x, y));
                _pathGeometry.AddGeometry(geo);
#else
                // AG-HACK
                throw new InvalidOperationException("Silverlight cannot create geometry of glyphs.");
                // TODO: Get the outline directly from the font.
#endif
#endif
            }
            catch
            {
                throw;
            }
        }
开发者ID:Core2D,项目名称:PDFsharp,代码行数:90,代码来源:XGraphicsPath.cs

示例4: AddLine

 /// <summary>
 /// Adds  a line segment to current figure.
 /// </summary>
 public void AddLine(XPoint pt1, XPoint pt2)
 {
   this.items.Add(new XGraphicsPathItem(XGraphicsPathItemType.Lines, pt1, pt2));
   this.dirty = true;
   this.gdipPath.AddLine(pt1.ToPointF(), pt2.ToPointF());
 }
开发者ID:BackupTheBerlios,项目名称:zp7-svn,代码行数:9,代码来源:XGraphicsPath.cs

示例5: AddString

    /// <summary>
    /// Adds a text string to this path.
    /// </summary>
    public void AddString(string s, XFontFamily family, XFontStyle style, double emSize, XPoint origin, XStringFormat format)
    {
      try
      {
#if GDI
        // TODOWPF
        this.gdipPath.AddString(s, family.gdiFamily, (int)style, (float)emSize, origin.ToPointF(), format.RealizeGdiStringFormat());
#endif
#if WPF
        Typeface typeface = FontHelper.CreateTypeface(family, style);
        FormattedText ft = new FormattedText(s, CultureInfo.CurrentCulture, FlowDirection.LeftToRight, typeface, emSize,
          System.Windows.Media.Brushes.Black);
        Geometry geo = ft.BuildGeometry(origin);
        this.pathGeometry.AddGeometry(geo);
#endif
      }
      catch { }
    }
开发者ID:AnthonyNystrom,项目名称:Pikling,代码行数:21,代码来源:XGraphicsPath.cs


注:本文中的PdfSharp.Drawing.XPoint.ToPointF方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。