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


C# Drawing.XRect类代码示例

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


XRect类属于PdfSharp.Drawing命名空间,在下文中一共展示了XRect类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BeginBox

        /// <summary>
        /// Draws a sample box.
        /// </summary>
        public void BeginBox(XGraphics gfx, int number)
        {
            //obracene XY
            gfx.RotateAtTransform(90.0, new XPoint(height / 4, width / 4));
            gfx.TranslateTransform(+62, +63);
            //const int dEllipse = 15;
            XRect rect = new XRect(0, 0, height /2 -2, width/2 -2);

            if (number % 2 == 0)
                rect.X += height/2 +2;
            rect.Y =  ((number - 1) / 2) * (-width/2 - 3);
            //rect.Inflate(-10, -10);
            //XRect rect2 = rect;

            XPen pen = new XPen(XColors.Black, 1);

            gfx.DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height);

            //rect2.Offset(this.borderWidth, this.borderWidth);
            //gfx.DrawRoundedRectangle(new XSolidBrush(this.shadowColor), rect2, new XSize(dEllipse + 8, dEllipse + 8));
            //XLinearGradientBrush brush = new XLinearGradientBrush(rect, this.backColor, this.backColor2, XLinearGradientMode.Vertical);
            //gfx.DrawRoundedRectangle(this.borderPen, brush, rect, new XSize(dEllipse, dEllipse));
            //rect.Inflate(-5, -5);

            //rect.Inflate(-10, -5);
            //rect.Y += 20;
            //rect.Height -= 20;
            ////gfx.DrawRectangle(XPens.Red, rect);

            //    gfx.TranslateTransform(rect.X, rect.Y);

            this.state = gfx.Save();
        }
开发者ID:Jeycob,项目名称:PenezniDenik,代码行数:36,代码来源:PDFbase.cs

示例2: GetBoundingBox

 /// <summary>
 /// Gets the smallest rectangle that completely contains all segments of the figure.
 /// </summary>
 public XRect GetBoundingBox()
 {
   XRect rect = new XRect(StartPoint.X, StartPoint.Y, 0, 0);
   foreach (PathSegment segment in Segments)
     rect.Union(segment.GetBoundingBox());
   return rect;
 }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:10,代码来源:PathFigure.cs

示例3: AreClose

 /// <summary>
 /// Indicates whether the values are so close that they can be considered as equal.
 /// </summary>
 public static bool AreClose(XRect rect1, XRect rect2)
 {
   if (rect1.IsEmpty)
     return rect2.IsEmpty;
   return !rect2.IsEmpty && AreClose(rect1.X, rect2.X) && AreClose(rect1.Y, rect2.Y) &&
     AreClose(rect1.Height, rect2.Height) && AreClose(rect1.Width, rect2.Width);
 }
开发者ID:inexorabletash,项目名称:PDFsharp,代码行数:10,代码来源:DoubleUtil.cs

示例4: RenderPage

    /// <summary>
    /// Demonstrates serveral bar code types.
    /// </summary>
    public override void RenderPage(XGraphics gfx)
    {
      XRect rc;
      base.RenderPage(gfx);

      Graphics grfx = gfx.Internals.Graphics;

      Code2of5Interleaved bc25 = new Code2of5Interleaved();
      bc25.Text = "123456";
      bc25.Size = new XSize(90, 30);
      //bc25.Direction = BarCodeDirection.RightToLeft;
      bc25.TextLocation = TextLocation.Above;
      gfx.DrawBarCode(bc25, XBrushes.DarkBlue, new XPoint(100, 100));

      CodeDataMatrix dm = new CodeDataMatrix("test", 26);
      dm.Size = new XSize(XUnit.FromMillimeter(15), XUnit.FromMillimeter(15));
      gfx.DrawMatrixCode(dm, XBrushes.DarkBlue, new XPoint(300, 100));

      rc = new XRect(30, 200, XUnit.FromCentimeter(9.3) + XUnit.FromMillimeter(0.5), XUnit.FromMillimeter(6));
      gfx.DrawRectangle(new XSolidBrush(XColor.FromArgb(128, XColors.LightSeaGreen)), rc);

      CodeOmr omr = new CodeOmr(0xF8F5FF3F.ToString(), rc.Size, CodeDirection.LeftToRight);
      omr.MakerDistance = XUnit.FromMillimeter(3);
      omr.MakerThickness = XUnit.FromMillimeter(0.5);
      gfx.DrawBarCode(omr, XBrushes.Black, rc.Center);

      omr.Direction = CodeDirection.RightToLeft;
      gfx.DrawBarCode(omr, XBrushes.Black, rc.Center + new XSize(0, 50));

      omr.Direction = CodeDirection.RightToLeft;
      gfx.DrawBarCode(omr, XBrushes.Black, rc.Center + new XSize(0, 50));

      omr.Direction = CodeDirection.TopToBottom;
      gfx.DrawBarCode(omr, XBrushes.Black, rc.Center + new XSize(300, 25));
    }
开发者ID:vronikp,项目名称:EventRegistration,代码行数:38,代码来源:BarCodesTypes.cs

示例5: CreatePdfPage

        private static void CreatePdfPage(List<JiraTicket> issues, ref PdfDocument pdf)
        {
            PdfPage page = pdf.AddPage();
            page.Size = PdfSharp.PageSize.A4;
            page.Orientation = PdfSharp.PageOrientation.Landscape;

            for (int j = 0; j < issues.Count; j++)
            {
                string text = issues[j].fields.issuetype.name + System.Environment.NewLine + issues[j].key
                  + System.Environment.NewLine + issues[j].fields.summary + System.Environment.NewLine
                  + issues[j].fields.customfield_10008;

                XGraphics gfx = XGraphics.FromPdfPage(page);
                XFont font = new XFont("Verdana", 20, XFontStyle.Bold);
                XTextFormatter tf = new XTextFormatter(gfx);
                XRect rect = new XRect();

                if (j < 3)
                {
                    rect = new XRect(15, 15 + j * 180, 400, 170);
                }
                else
                {
                    rect = new XRect(430, 15 + (j - 3) * 180, 400, 170);
                }

                gfx.DrawRectangle(XBrushes.SeaShell, rect);
                tf.DrawString(text, font, XBrushes.Black, rect, XStringFormats.TopLeft);
                gfx.Dispose();
            }
        }
开发者ID:xcyroo,项目名称:SprintAnalyzer,代码行数:31,代码来源:PdfCreator.cs

示例6: GetRect

 /// <summary>
 /// Calculates thumb rectangle.
 /// </summary>
 static XRect GetRect(int index)
 {
     XRect rect = new XRect(0, 0, A4Width / 3 * 0.9, A4Height / 3 * 0.9);
       rect.X = (index % 3) * A4Width / 3 + A4Width * 0.05 / 3;
       rect.Y = (index / 3) * A4Height / 3 + A4Height * 0.05 / 3;
       return rect;
 }
开发者ID:dankennedy,项目名称:MigraDoc,代码行数:10,代码来源:Program.cs

示例7: AddRowTest

        public void AddRowTest()
        {
            var percentWidths = new[] { 20, 30, 50 };
            var controls = new[]
                {
                    new InputBox(new XRect(0, 0, 10, 20), ""),
                    new InputBox(new XRect(0, 0, 10, 30), ""),
                    new InputBox(new XRect(0, 0, 10, 50), ""),
                };

            var rect = new XRect(0, 0, 100 + DefaultValues.Groupbox.MarginLeft + DefaultValues.Groupbox.MarginRight, 10);
            var target = new GroupBox(rect);

            target.AddRow(controls, percentWidths);
            foreach (var control in controls.Zip(target.Controls, (i, o) => new { Input = i, Output = o }))
            {
                Assert.AreSame(control.Input, control.Output);
            }

            Assert.AreEqual(target.Controls.ElementAt(0).Rect.Left, 0);
            Assert.AreEqual(target.Controls.ElementAt(1).Rect.Left, 20);
            Assert.AreEqual(target.Controls.ElementAt(2).Rect.Left, 50);

            Assert.AreEqual(target.Controls.ElementAt(0).Rect.Width, 20);
            Assert.AreEqual(target.Controls.ElementAt(1).Rect.Width, 30);
            Assert.AreEqual(target.Controls.ElementAt(2).Rect.Width, 50);

            Assert.AreEqual(target.Rect.Height, target.MarginBottom + target.MarginTop + 50);
        }
开发者ID:batas2,项目名称:PdfSharp.Controls,代码行数:29,代码来源:GroupBoxTest.cs

示例8: Box

    void Box(XGraphics gfx, XRect rect, double startAngle, double sweepAngle)
    {
      double xc = rect.X + rect.Width / 2;
      double yc = rect.Y + rect.Height / 2;
      double a = startAngle * 0.0174532925199433;
      double b = (startAngle + sweepAngle) * 0.0174532925199433;

      XGraphicsState state = gfx.Save();
      gfx.IntersectClip(rect);


#if true
#if true_
      for (double deg = 0; deg < 360; deg += 10)
        gfx.DrawLine(XPens.Yellow, xc, yc, 
          (xc + rect.Width / 2 * Math.Cos(deg * 0.0174532925199433)), 
          (yc + rect.Height / 2 * Math.Sin(deg * 0.0174532925199433)));
#endif
      double f = Math.Max(rect.Width / 2, rect.Height / 2);
      for (double deg = 0; deg < 360; deg += 10)
        gfx.DrawLine(XPens.Goldenrod, xc, yc, 
          (xc + f * Math.Cos(deg * 0.0174532925199433)), 
          (yc + f * Math.Sin(deg * 0.0174532925199433)));

      gfx.DrawLine(XPens.PaleGreen, xc, rect.Y, xc, rect.Y + rect.Height);
      gfx.DrawLine(XPens.PaleGreen, rect.X, yc, rect.X + rect.Width, yc);
      //gfx.DrawLine(XPens.DarkGray, xc, yc, (xc + rect.Width / 2 * Math.Cos(a)), (yc + rect.Height / 2 * Math.Sin(a)));
      //gfx.DrawLine(XPens.DarkGray, xc, yc, (xc + rect.Width / 2 * Math.Cos(b)), (yc + rect.Height / 2 * Math.Sin(b)));
#endif
      gfx.Restore(state);
      gfx.DrawRectangle(properties.Pen1.Pen, rect);
    }
开发者ID:AnthonyNystrom,项目名称:Pikling,代码行数:32,代码来源:LinesArc.cs

示例9: GenerateApplicationPdf

        internal static byte[] GenerateApplicationPdf(Application application)
        {
            //Create pdf document
            PdfDocument pdf = new PdfDocument();
            PdfPage page = pdf.AddPage();
            //Create pdf content
            Document doc = CreateDocument("Application", string.Format("{1}, {0}",application.Person.Name, application.Person.Surname));
            PopulateDocument(ref doc, application);
            //Create renderer for content
            DocumentRenderer renderer = new DocumentRenderer(doc);
            renderer.PrepareDocument();
            XRect A4 = new XRect(0, 0, XUnit.FromCentimeter(21).Point, XUnit.FromCentimeter(29.7).Point);
            XGraphics gfx = XGraphics.FromPdfPage(page);

            int pages = renderer.FormattedDocument.PageCount;
            for(int i = 0; i < pages; i++)
            {
                var container = gfx.BeginContainer(A4, A4, XGraphicsUnit.Point);
                gfx.DrawRectangle(XPens.LightGray, A4);
                renderer.RenderPage(gfx, (i + 1));
                gfx.EndContainer(container);
            }

            using (MemoryStream ms = new MemoryStream())
            {
                pdf.Save(ms, true);
                return ms.ToArray();
            }
        }
开发者ID:majilik,项目名称:RecruitmentSystem,代码行数:29,代码来源:PdfGenerator.cs

示例10: RenderPage

    public override void RenderPage(XGraphics gfx)
    {
      //base.RenderPage(gfx);

      XTextFormatter tf = new XTextFormatter(gfx);
      XRect rect;
      string text = this.properties.Font1.Text;
      //text = "First\nSecond Line\nlaksdjf 234 234";

      rect = new XRect(40, 100, 250, 200);
      gfx.DrawRectangle(XBrushes.SeaShell, rect);
      //tf.Alignment = ParagraphAlignment.Left;
      tf.DrawString(text, this.properties.Font1.Font, this.properties.Font1.Brush, 
        rect, XStringFormats.TopLeft);

      rect = new XRect(310, 100, 250, 200);
      gfx.DrawRectangle(XBrushes.SeaShell, rect);
      tf.Alignment = XParagraphAlignment.Right;
      tf.DrawString(text, this.properties.Font1.Font, this.properties.Font1.Brush,
        rect, XStringFormats.TopLeft);

      rect = new XRect(40, 400, 250, 200);
      gfx.DrawRectangle(XBrushes.SeaShell, rect);
      tf.Alignment = XParagraphAlignment.Center;
      tf.DrawString(text, this.properties.Font1.Font, this.properties.Font1.Brush,
        rect, XStringFormats.TopLeft);

      rect = new XRect(310, 400, 250, 200);
      gfx.DrawRectangle(XBrushes.SeaShell, rect);
      tf.Alignment = XParagraphAlignment.Justify;
      tf.DrawString(text, this.properties.Font1.Font, this.properties.Font1.Brush,
        rect, XStringFormats.TopLeft);
    }
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:33,代码来源:Layout1.cs

示例11: Draw

        public void Draw(XGraphics gfx)
        {
            var tf = new XTextFormatter(gfx) {Alignment = Alignment};

            XSize size = gfx.MeasureString(Content, Font);
            Rect = new XRect(Rect.X, Rect.Y, Rect.Width, size.Height*(Math.Ceiling(size.Width/Rect.Width) + 1));
            tf.DrawString(Content, Font, Brush, Rect, XStringFormats.TopLeft);
        }
开发者ID:batas2,项目名称:PdfSharp.Controls,代码行数:8,代码来源:Label.cs

示例12: Arc

    public void Arc(XGraphics gfx, XRect rect, double startAngle, double sweepAngle)
    {
      Box(gfx, rect, startAngle, sweepAngle);

      gfx.DrawArc(properties.Pen3.Pen, rect, startAngle, sweepAngle);

      DrawHandMadeArc(gfx, XPens.Red, rect, startAngle, sweepAngle);
    }
开发者ID:AnthonyNystrom,项目名称:Pikling,代码行数:8,代码来源:LinesArc.cs

示例13: Pagel

 public Pagel(Pagel parent, XRect percetileRectangle)
 {
     parent.AddChild(this);
     this.minPoint = new XPoint(parent.Rectangle.X * percetileRectangle.X, parent.Rectangle.Y * percetileRectangle.Y);
     this.maxPoint = minPoint + new XPoint(parent.Rectangle.Width * percetileRectangle.Width,
         parent.Rectangle.Height * percetileRectangle.Height);
     this.Rectangle = new XRect(minPoint, maxPoint);
 }
开发者ID:Nodgez,项目名称:PDFReporter,代码行数:8,代码来源:Pagel.cs

示例14: PlaatsInhoud

        private static void PlaatsInhoud()
        {
            string inhoud = string.Format(Resources.VerhuisBriefTekst, _deelnemer.Naam);

            var formatter = new XTextFormatter(_gfx);
            XRect layoutRect = new XRect(_positionX, _positionY += 25, _page.Width - 100, _page.Height - _positionY);
            formatter.DrawString(inhoud, _font, XBrushes.Black, layoutRect);
        }
开发者ID:jpkleemans,项目名称:cqrs-sample,代码行数:8,代码来源:Verhuisbrief.cs

示例15: InputBox

        public InputBox(XRect rect)
        {
            Rect = rect;

            Brush = DefaultValues.Inputbox.Brush;
            Pen = DefaultValues.Inputbox.Pen;
            Font = DefaultValues.Inputbox.Font;
        }
开发者ID:batas2,项目名称:PdfSharp.Controls,代码行数:8,代码来源:InputBox.cs


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