當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。