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


C# Block.InsertLineBreak方法代码示例

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


在下文中一共展示了Block.InsertLineBreak方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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


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