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


C# Block.InsertText方法代码示例

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


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

示例1: Render

        internal override bool Render(UIElement element, PdfRenderContext context)
        {
            TextBlock textBlock = element as TextBlock;
            if (textBlock == null)
            {
                return false;
            }

            if (!string.IsNullOrEmpty(textBlock.Text))
            {
                using (context.drawingSurface.SaveProperties())
                {
                    SetFill(context, textBlock.Foreground, textBlock.ActualWidth, textBlock.ActualHeight);
                    SetFontFamily(context.drawingSurface, textBlock.FontFamily);
                    context.drawingSurface.TextProperties.FontSize = textBlock.FontSize;

                    Block block = new Block();
                    block.TextProperties.CopyFrom(context.drawingSurface.TextProperties);
                    block.GraphicProperties.CopyFrom(context.drawingSurface.GraphicProperties);
                    string[] textLines = textBlock.Text.Split(new string[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);

                    foreach (string textLine in textLines)
                    {
                        block.InsertText(textLine);
                        block.InsertLineBreak();
                    }

                    context.drawingSurface.DrawBlock(block);
                }
            }

            return true;
        }
开发者ID:Motaz-Al-Zoubi,项目名称:xaml-sdk,代码行数:33,代码来源:TextBlockRenderer.cs

示例2: CenterText

        private static void CenterText(FixedContentEditor editor, string text)
        {
            Block block = new Block();
            block.HorizontalAlignment = HorizontalAlignment.Center;
            block.VerticalAlignment = VerticalAlignment.Center;
            block.GraphicProperties.FillColor = RgbColors.White;
            block.InsertText(text);

            editor.DrawBlock(block, new Size(96, 96));
        }
开发者ID:Motaz-Al-Zoubi,项目名称:xaml-sdk,代码行数:10,代码来源:ExampleViewModel_SL.cs

示例3: CreatePageWithImage

        private void CreatePageWithImage(RadFixedDocument document, string imageExtension, EncodedImageData imageData)
        {
            RadFixedPage page = document.Pages.AddPage();
            page.Size = PageSize;
            FixedContentEditor editor = new FixedContentEditor(page);
            editor.Position.Translate(Margins.Left, Margins.Top);

            Block block = new Block();
            block.HorizontalAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.HorizontalAlignment.Center;
            block.TextProperties.FontSize = 22;
            block.InsertText(string.Format("This is {0} image in {1} color space encoded with {2} filter.", imageExtension, imageData.ColorSpace, imageData.Filters.FirstOrDefault() ?? "None"));
            Size blockSize = block.Measure(RemainingPageSize);
            editor.DrawBlock(block, RemainingPageSize);

            editor.Position.Translate(Margins.Left, blockSize.Height + Margins.Top + 50);

            Block imageBlock = new Block();
            imageBlock.HorizontalAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.HorizontalAlignment.Center;
            imageBlock.InsertImage(new ImageSource(imageData), new Size(imageData.Width, imageData.Height));
            editor.DrawBlock(imageBlock, RemainingPageSize);
        }
开发者ID:abererk,项目名称:xaml-sdk,代码行数:21,代码来源:MainPage.xaml.cs

示例4: DrawFunnelFigure

        private void DrawFunnelFigure(FixedContentEditor editor)
        {
            editor.GraphicProperties.IsStroked = false;
            editor.GraphicProperties.FillColor = new RgbColor(231, 238, 247);
            editor.DrawEllipse(new Point(250, 70), 136, 48);

            editor.GraphicProperties.IsStroked = true;
            editor.GraphicProperties.StrokeColor = RgbColors.White;
            editor.GraphicProperties.StrokeThickness = 1;
            editor.GraphicProperties.FillColor = new RgbColor(91, 155, 223);
            editor.DrawEllipse(new Point(289, 77), 48, 48);

            editor.Position.Translate(291, 204);
            CenterText(editor, "Fonts");

            editor.Position.Translate(0, 0);
            editor.DrawEllipse(new Point(238, 274), 48, 48);
            editor.Position.Translate(190, 226);
            CenterText(editor, "Images");

            editor.Position.Translate(0, 0);
            editor.DrawEllipse(new Point(307, 347), 48, 48);
            editor.Position.Translate(259, 299);
            CenterText(editor, "Shapes");

            editor.Position.Translate(0, 0);
            PathGeometry arrow = new PathGeometry();
            PathFigure figure = arrow.Figures.AddPathFigure();
            figure.StartPoint = new Point(287, 422);
            figure.IsClosed = true;
            figure.Segments.AddLineSegment(new Point(287, 438));
            figure.Segments.AddLineSegment(new Point(278, 438));
            figure.Segments.AddLineSegment(new Point(300, 454));
            figure.Segments.AddLineSegment(new Point(322, 438));
            figure.Segments.AddLineSegment(new Point(313, 438));
            figure.Segments.AddLineSegment(new Point(313, 422));

            editor.DrawPath(arrow);

            editor.GraphicProperties.FillColor = new RgbColor(80, 255, 255, 255);
            editor.GraphicProperties.IsStroked = true;
            editor.GraphicProperties.StrokeThickness = 1;
            editor.GraphicProperties.StrokeColor = new RgbColor(91, 155, 223);

            PathGeometry funnel = new PathGeometry();
            funnel.FillRule = FillRule.EvenOdd;
            figure = funnel.Figures.AddPathFigure();
            figure.IsClosed = true;
            figure.StartPoint = new Point(164, 245);
            figure.Segments.AddArcSegment(new Point(436, 245), 136, 48);
            figure.Segments.AddArcSegment(new Point(164, 245), 136, 48);

            figure = funnel.Figures.AddPathFigure();
            figure.IsClosed = true;
            figure.StartPoint = new Point(151, 245);
            figure.Segments.AddArcSegment(new Point(449, 245), 149, 61);
            figure.Segments.AddLineSegment(new Point(332, 415)); figure.Segments.AddArcSegment(new Point(268, 415), 16, 4);

            editor.DrawPath(funnel);

            editor.Position.Translate(164, 455);
            Block block = new Block();
            block.TextProperties.Font = editor.TextProperties.Font;
            block.GraphicProperties.FillColor = RgbColors.Black;
            block.HorizontalAlignment = HorizontalAlignment.Center;
            block.VerticalAlignment = VerticalAlignment.Top;
            block.TextProperties.FontSize = 18;
            block.InsertText("PDF");
            editor.DrawBlock(block, new Size(272, double.PositiveInfinity));
        }
开发者ID:Motaz-Al-Zoubi,项目名称:xaml-sdk,代码行数:70,代码来源:ExampleViewModel_WPF.cs

示例5: DrawText

        private void DrawText(FixedContentEditor editor, double maxWidth)
        {
            double currentTopOffset = 470;
            currentTopOffset += defaultLineHeight * 2;
            editor.Position.Translate(defaultLeftIndent, currentTopOffset);
            editor.TextProperties.FontSize = 11;

            Block block = new Block();
            block.TextProperties.FontSize = 11;
            block.TextProperties.TrySetFont(new FontFamily("Arial"));
            block.InsertText("A wizard's job is to vex ");
            using (block.GraphicProperties.Save())
            {
                block.GraphicProperties.FillColor = new RgbColor(255, 146, 208, 80);
                block.InsertText("chumps");
            }

            block.InsertText(" quickly in fog.");
            editor.DrawBlock(block, new Size(maxWidth, double.PositiveInfinity));

            currentTopOffset += defaultLineHeight;
            editor.Position.Translate(defaultLeftIndent, currentTopOffset);

            block = new Block();
            block.TextProperties.FontSize = 11;
            block.TextProperties.TrySetFont(new FontFamily("Trebuchet MS"));
            block.InsertText("A wizard's job is to vex chumps ");
            using (block.TextProperties.Save())
            {
                block.TextProperties.UnderlinePattern = UnderlinePattern.Single;
                block.TextProperties.UnderlineColor = editor.GraphicProperties.FillColor;
                block.InsertText("quickly");
            }

            block.InsertText(" in fog.");
            editor.DrawBlock(block, new Size(maxWidth, double.PositiveInfinity));

            currentTopOffset += defaultLineHeight;
            editor.Position.Translate(defaultLeftIndent, currentTopOffset);
            block = new Block();
            block.TextProperties.FontSize = 11;
            block.TextProperties.TrySetFont(new FontFamily("Algerian"));
            block.InsertText("A ");
            using (block.TextProperties.Save())
            {
                block.TextProperties.UnderlinePattern = UnderlinePattern.Single;
                block.TextProperties.UnderlineColor = editor.GraphicProperties.FillColor;
                block.InsertText("wizard's");
            }

            block.InsertText(" job is to vex chumps quickly in fog.");
            editor.DrawBlock(block, new Size(maxWidth, double.PositiveInfinity));

            currentTopOffset += defaultLineHeight;
            editor.Position.Translate(defaultLeftIndent, currentTopOffset);

            editor.TextProperties.TrySetFont(new FontFamily("Lucida Calligraphy"));
            editor.DrawText("A wizard's job is to vex chumps quickly in fog.", new Size(maxWidth, double.PositiveInfinity));

            currentTopOffset += defaultLineHeight + 2;
            editor.Position.Translate(defaultLeftIndent, currentTopOffset);
            block = new Block();
            block.TextProperties.FontSize = 11;
            block.TextProperties.TrySetFont(new FontFamily("Consolas"));
            block.InsertText("A wizard's job is to vex chumps ");
            using (block.TextProperties.Save())
            {
                block.TextProperties.TrySetFont(new FontFamily("Consolas"), FontStyles.Normal, FontWeights.Bold);
                block.InsertText("quickly");
            }

            block.InsertText(" in fog.");
            editor.DrawBlock(block, new Size(maxWidth, double.PositiveInfinity));

            currentTopOffset += defaultLineHeight;
            editor.Position.Translate(defaultLeftIndent, currentTopOffset);
            editor.TextProperties.TrySetFont(new FontFamily("Arial"));
            editor.DrawText("Ταχίστη αλώπηξ βαφής ψημένη γη, δρασκελίζει υπέρ νωθρού κυνός.", new Size(maxWidth, double.PositiveInfinity));

            currentTopOffset += defaultLineHeight;
            editor.Position.Translate(defaultLeftIndent, currentTopOffset);
            editor.DrawText("В чащах юга жил бы цитрус? Да, но фальшивый экземпляр!", new Size(maxWidth, double.PositiveInfinity));

            currentTopOffset += defaultLineHeight;
            editor.Position.Translate(defaultLeftIndent, currentTopOffset);
            editor.DrawText("El pingüino Wenceslao hizo kilómetros bajo exhaustiva lluvia y frío; añoraba a su querido cachorro.", new Size(maxWidth, double.PositiveInfinity));

            currentTopOffset += defaultLineHeight;
            editor.Position.Translate(defaultLeftIndent, currentTopOffset);

            editor.TextProperties.TrySetFont(new FontFamily("Malgun Gothic"));
            editor.DrawText("키스의 고유조건은 입술끼리 만나야 하고 특별한 기술은 필요치 않다.", new Size(maxWidth, double.PositiveInfinity));
        }
开发者ID:Motaz-Al-Zoubi,项目名称:xaml-sdk,代码行数:93,代码来源:ExampleViewModel_WPF.cs

示例6: DrawDescription

        private void DrawDescription(FixedContentEditor editor, double maxWidth)
        {
            Block block = new Block();
            block.GraphicProperties.FillColor = RgbColors.Black;
            block.HorizontalAlignment = HorizontalAlignment.Left;
            block.TextProperties.FontSize = 14;
            block.TextProperties.TrySetFont(new FontFamily("Calibri"), FontStyles.Italic, FontWeights.Bold);
            block.InsertText("RadPdfProcessing");
            block.TextProperties.TrySetFont(new System.Windows.Media.FontFamily("Calibri"));
            block.InsertText(" is a document processing library that enables your application to import and export files to and from PDF format. The document model is entirely independent from UI and allows you to generate sleek documents with differently formatted text, images, shapes and more.");

            editor.DrawBlock(block, new Size(maxWidth, double.PositiveInfinity));
        }
开发者ID:Motaz-Al-Zoubi,项目名称:xaml-sdk,代码行数:13,代码来源:ExampleViewModel_WPF.cs

示例7: DrawCenteredText

        private static void DrawCenteredText(FixedContentEditor editor, string text, Size size)
        {
            Block block = new Block();

            block.TextProperties.TrySetFont(new FontFamily("Arial"));
            block.HorizontalAlignment = HorizontalAlignment.Center;
            block.VerticalAlignment = VerticalAlignment.Center;
            block.GraphicProperties.FillColor = RgbColors.White;
            block.TextProperties.FontSize = 16;
            block.InsertText(text);

            editor.DrawBlock(block, size);
        }
开发者ID:netintellect,项目名称:PluralsightSpaJumpStartFinal,代码行数:13,代码来源:ExampleViewModel.cs

示例8: DrawDescription

        private void DrawDescription(double maxWidth)
        {
            Block block = new Block();

            this.SetTextProperties(block, new RgbColor(155, 199, 5), 18, new FontFamily("Segoe UI"));
            block.InsertText("Thank you for choosing Telerik RadPdfProcessing!");
            editor.DrawBlock(block, new Size(maxWidth, double.PositiveInfinity));

            block = new Block();
            this.SetTextProperties(block, RgbColors.Black, 25, new FontFamily("Segoe UI"));
            block.InsertLineBreak();
            this.SetTextProperties(block, RgbColors.Black, 11, new FontFamily("Segoe UI"), true);
            block.InsertText("RadPdfProcessing");

            this.SetTextProperties(block, RgbColors.Black, 11, new FontFamily("Segoe UI"));
            block.InsertText(" is a document processing library that enables your application to import and export files to and from PDF format. The document model is entirely independent from UI and allows you to generate sleek documents with differently formatted text, images, shapes and more.");
            editor.DrawBlock(block, new Size(maxWidth, double.PositiveInfinity));

            double currentTopOffset = 480;
            editor.Position.Translate(ExampleDocumentSizes.DefaultLeftIndent, currentTopOffset);
            block = new Block();
            this.SetTextProperties(block, RgbColors.Black, 25, new FontFamily("Segoe UI"), true);
            block.InsertLineBreak();
            this.SetTextProperties(block, RgbColors.Black, 13, new FontFamily("Times New Roman"), true);
            block.InsertText("RadPdfProcessing");
            this.SetTextProperties(block, RgbColors.Black, 13, new FontFamily("Times New Roman"));
            block.InsertText(" was built with performance and stability in mind. The document automation is fast and has a low memory footprint even with large amounts of data.");
            editor.DrawBlock(block, new Size(maxWidth, double.PositiveInfinity));

            currentTopOffset += ExampleDocumentSizes.DefaultLineHeight * 3;
            editor.Position.Translate(ExampleDocumentSizes.DefaultLeftIndent, currentTopOffset);

            block = new Block();
            this.SetTextProperties(block, RgbColors.Black, 25, new FontFamily("Miriad pro"));
            block.InsertLineBreak();
            this.SetTextProperties(block, RgbColors.Black, 11, new FontFamily("Miriad pro"), false, true);
            block.InsertText("The intuitive API allows you to swiftly generate documents from scratch. Designed with the user in mind, RadPdfProcessing is straightforward and easy to use.");
            editor.DrawBlock(block, new Size(maxWidth, double.PositiveInfinity));

            block = new Block();
            this.SetTextProperties(block, new RgbColor(45, 178, 0), 35, new FontFamily("Segoe Print"));
            block.InsertLineBreak();

            this.SetTextProperties(block, new RgbColor(45, 178, 0), 12, new FontFamily("Segoe Print"));
            block.InsertText("September, 2014");
            block.InsertLineBreak();
            block.InsertText("by XAML Team");

            currentTopOffset += ExampleDocumentSizes.DefaultLineHeight * 2;

            editor.DrawBlock(block, new Size(maxWidth, double.PositiveInfinity));
            DrawLogo();
        }
开发者ID:netintellect,项目名称:PluralsightSpaJumpStartFinal,代码行数:53,代码来源:ExampleViewModel.cs

示例9: ExportContent

        private static void ExportContent(ContentControl control, Rect bounds, double angle, RadFixedPage page, Func<Size, Point> positionFunc, string contentString = null)
        {
            string text = contentString ?? control.Content.ToString();
            if (string.IsNullOrWhiteSpace(text)) return;
            FixedContentEditor textEditor = new FixedContentEditor(page);
            var block = new Block();

            // Set the text and graphic properties.
            block.TextProperties.FontSize = control.FontSize;
            block.TextProperties.RenderingMode = RenderingMode.Fill;
            block.TextProperties.TrySetFont(control.FontFamily, control.FontStyle, control.FontWeight);
            block.GraphicProperties.FillColor = ColorHelper.GetColor(control.Foreground, control.Opacity, bounds);
            block.GraphicProperties.StrokeColor = block.GraphicProperties.FillColor;

            // Measure the text.
            block.InsertText(text);
            var boundsSize = bounds.ToSize();
            var availableSize = new Size(boundsSize.Width - control.Padding.Left - control.Padding.Right, boundsSize.Width - control.Padding.Top - control.Padding.Bottom);
            var textSize = block.Measure(availableSize);
            var position = positionFunc(textSize);
            var textGroup = new TransformGroup();
            textGroup.Children.Add(new RotateTransform() { Angle = angle, CenterX = textSize.Width / 2, CenterY = textSize.Height / 2 });
            textGroup.Children.Add(new TranslateTransform() { X = position.X, Y = position.Y });
            textEditor.Position = new MatrixPosition(textGroup.Value);

            textEditor.DrawBlock(block, availableSize);
        }
开发者ID:CJMarsland,项目名称:xaml-sdk,代码行数:27,代码来源:ExportHelper.cs

示例10: DrawDescription

        private void DrawDescription(FixedContentEditor editor, double maxWidth)
        {
            Block block = new Block();
            block.GraphicProperties.FillColor = RgbColors.Black;
            block.HorizontalAlignment = HorizontalAlignment.Left;
            block.TextProperties.Font = FontsRepository.HelveticaBoldOblique;
            block.InsertText("RadPdfProcessing");
            block.TextProperties.Font = FontsRepository.Helvetica;
            block.InsertText(" is a document processing library that enables your application to import and export files to and from PDF format. The document model is entirely independent from UI and allows you to generate sleek documents with differently formatted text, images, shapes and more.");

            editor.DrawBlock(block, new Size(maxWidth, double.PositiveInfinity));
        }
开发者ID:Motaz-Al-Zoubi,项目名称:xaml-sdk,代码行数:12,代码来源:ExampleViewModel_SL.cs

示例11: DrawText

        private void DrawText(FixedContentEditor editor, double maxWidth)
        {
            double currentTopOffset = 500;
            currentTopOffset += defaultLineHeight * 2;
            editor.Position.Translate(defaultLeftIndent, currentTopOffset);
            Block block = new Block();
            block.TextProperties.Font = FontsRepository.Helvetica;
            block.InsertText("A wizard's job is to vex ");
            using (block.GraphicProperties.Save())
            {
                block.GraphicProperties.FillColor = new RgbColor(255, 146, 208, 80);
                block.InsertText("chumps");
            }

            block.InsertText(" quickly in fog.");
            editor.DrawBlock(block, new Size(maxWidth, double.PositiveInfinity));

            currentTopOffset += defaultLineHeight;
            editor.Position.Translate(defaultLeftIndent, currentTopOffset);
            block = new Block();
            block.TextProperties.Font = FontsRepository.TimesRoman;
            block.InsertText("A wizard's job is to vex chumps ");
            using (block.TextProperties.Save())
            {
                block.TextProperties.UnderlinePattern = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.UnderlinePattern.Single;
                block.TextProperties.UnderlineColor = editor.GraphicProperties.FillColor;
                block.InsertText("quickly");
            }

            block.InsertText(" in fog.");
            editor.DrawBlock(block, new Size(maxWidth, double.PositiveInfinity));

            currentTopOffset += defaultLineHeight;
            editor.Position.Translate(defaultLeftIndent, currentTopOffset);
            block = new Block();
            block.TextProperties.Font = FontsRepository.Courier;
            block.InsertText("A ");
            using (block.TextProperties.Save())
            {
                block.TextProperties.Font = FontsRepository.CourierBoldOblique;
                block.TextProperties.UnderlinePattern = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.UnderlinePattern.Single;
                block.TextProperties.UnderlineColor = editor.GraphicProperties.FillColor;
                block.InsertText("wizard's");
            }

            block.InsertText(" job is to vex chumps quickly in fog.");
            editor.DrawBlock(block, new Size(maxWidth, double.PositiveInfinity));
        }
开发者ID:Motaz-Al-Zoubi,项目名称:xaml-sdk,代码行数:48,代码来源:ExampleViewModel_SL.cs

示例12: AddPageWithImage

        private void AddPageWithImage(string description, ImageSource imageSource)
        {
            RadFixedPage page = this.document.Pages.AddPage();
            page.Size = PageSize;
            FixedContentEditor editor = new FixedContentEditor(page);
            editor.GraphicProperties.FillColor = new RgbColor(200, 200, 200);
            editor.DrawRectangle(new Rect(0, 0, PageSize.Width, PageSize.Height));
            editor.Position.Translate(Margins.Left, Margins.Top);

            Block block = new Block();
            block.HorizontalAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.HorizontalAlignment.Center;
            block.TextProperties.FontSize = 22;
            block.InsertText(description);
            Size blockSize = block.Measure(RemainingPageSize);
            editor.DrawBlock(block, RemainingPageSize);

            editor.Position.Translate(Margins.Left, blockSize.Height + Margins.Top + 20);

            Block imageBlock = new Block();
            imageBlock.HorizontalAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.HorizontalAlignment.Center;
            imageBlock.InsertImage(imageSource);
            editor.DrawBlock(imageBlock, RemainingPageSize);
        }
开发者ID:olatte65,项目名称:xaml-sdk,代码行数:23,代码来源:MainViewModel.cs

示例13: DrawBarChartContent

        private void DrawBarChartContent(FixedContentEditor editor)
        {
            editor.GraphicProperties.IsFilled = false;
            this.DrawCompanyLogo(editor);

            double leftMargin = this.GetLeftMargin(editor.Root.Size.Width);
            double offsetX;
            double offsetY;

            this.DrawChartFrame(leftMargin, editor, out offsetX, out offsetY);

            double offset = 20;
            double textWidth = 0;
            double rectMargin = 2;

            for (int i = 0; i < this.ExportedProductsCount; i++)
            {
                textWidth += rectSize + rectMargin + offset;
                textWidth += MeasureText(editor, this.products[i].Name).Width;
            }

            offsetX = leftMargin + ((chartWidth - textWidth) / 2);
            offsetY += 20;
            for (int i = 0; i < this.ExportedProductsCount; i++)
            {
                editor.Position.Translate(offsetX, offsetY);
                Tiling tiling = CreateTiling(offsetX, offsetY, rectSize, colors[i]);

                Block block = new Block();
                block.GraphicProperties.FillColor = tiling;
                block.GraphicProperties.IsStroked = false;
                block.InsertRectangle(new Rect(0, 0, rectSize, rectSize));
                block.GraphicProperties.FillColor = RgbColors.Black;
                block.InsertText(" " + this.products[i].Name);
                editor.DrawBlock(block);
                offsetX += block.DesiredSize.Width + offset;
            }

            offsetX = leftMargin;

            offsetY += 30;
            double markerHeight = (chartHeight - (offsetY - marginTop)) / markersCount;
            editor.Position.Translate(offsetX, offsetY);

            for (int i = markersCount - 1; i >= 0; i--)
            {
                DrawText(editor, string.Format("{0:C}", i * this.StepValue), markerAreaWidth, HorizontalAlignment.Right);
                if (i > 0)
                {
                    offsetY += markerHeight;
                    editor.Position.Translate(offsetX, offsetY);
                }
            }

            offsetX = leftMargin + markerAreaWidth + valuesMargin;
            double center = MeasureText(editor, "X").Height / 2;
            offsetY += center;
            double valueHeight = markerHeight / this.StepValue;
            double dataAreaWidth = chartWidth - markerAreaWidth - 2 * valuesMargin;

            double sectionWidth = dataAreaWidth / this.GetQuartersToExportCount();
            double barWidth = (sectionWidth - 2 * valuesMargin - 2 * this.ExportedProductsCount * barMargin) / this.ExportedProductsCount;
            for (int j = 0; j < this.quartersToExport.Keys.Count; j++)
            {
                if (!this.quartersToExport[j])
                {
                    continue;
                }

                editor.Position.Translate(offsetX, offsetY + 5);
                editor.GraphicProperties.FillColor = RgbColors.Black;
                DrawText(editor, string.Format("Q{0}", j + 1), sectionWidth, HorizontalAlignment.Center);
                editor.Position.Translate(0, 0);
                offsetX += valuesMargin;
                for (int i = 0; i < this.ExportedProductsCount; i++)
                {
                    Product product = this.products[i];
                    double h = product.Q[j] * valueHeight;
                    offsetX += barMargin;
                    Tiling tiling = CreateTiling(offsetX, offsetY - h, barWidth, colors[i]);
                    editor.GraphicProperties.FillColor = tiling;
                    editor.DrawRectangle(new Rect(offsetX, offsetY - h, barWidth, h));
                    offsetX += barWidth + barMargin;
                }

                offsetX += valuesMargin;
            }

            offsetX = leftMargin + markerAreaWidth + valuesMargin;
            DrawBarLine(editor, offsetX, offsetY, dataAreaWidth);
        }
开发者ID:netintellect,项目名称:PluralsightSpaJumpStartFinal,代码行数:91,代码来源:ExampleViewModel.cs


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