示例#1
0
        /// <summary>
        /// Creates the book image paragraph
        /// </summary>
        /// <param name="image"></param>
        /// <returns></returns>
        NParagraph CreateImageParagraph(NImage image)
        {
            NParagraph paragraph = new NParagraph();

            NImageInline inline = new NImageInline();

            inline.Image           = (NImage)image.DeepClone();
            inline.PreferredWidth  = new NMultiLength(ENMultiLengthUnit.Dip, 200);
            inline.PreferredHeight = new NMultiLength(ENMultiLengthUnit.Dip, 280);
            paragraph.Inlines.Add(inline);

            return(paragraph);
        }
示例#2
0
        protected override void PopulateRichText()
        {
            NSection section = new NSection();

            m_RichText.Content.Sections.Add(section);

            section.Blocks.Add(GetDescriptionBlock("Hyperlink Inlines", "The example shows how to use hyperlinks inlines.", 1));

            // Hyperlink inline with a hyperlink to an URL
            {
                NHyperlinkInline hyperlinkInline = new NHyperlinkInline();
                hyperlinkInline.Hyperlink = new NUrlHyperlink("http://www.nevron.com", ENUrlHyperlinkTarget.SameWindowSameFrame);
                hyperlinkInline.Text      = "Jump to www.nevron.com";

                NParagraph paragraph = new NParagraph();
                paragraph.Inlines.Add(hyperlinkInline);
                section.Blocks.Add(paragraph);
            }

            // Image inline with a hyperlink to an URL
            {
                NImageInline imageInline = new NImageInline();
                imageInline.Image     = Nov.Diagram.NResources.Image_Other_MyDrawLogo_png;
                imageInline.Hyperlink = new NUrlHyperlink("http://www.mydraw.com", ENUrlHyperlinkTarget.SameWindowSameFrame);

                NParagraph paragraph = new NParagraph();
                paragraph.Inlines.Add(imageInline);
                section.Blocks.Add(paragraph);
            }

            for (int i = 0; i < 10; i++)
            {
                section.Blocks.Add(new NParagraph("Some paragraph"));
            }

            // Bookmark inline
            {
                NParagraph paragraph = new NParagraph();

                NBookmarkInline bookmark = new NBookmarkInline();
                bookmark.Name = "MyBookmark";
                bookmark.Text = "This is a bookmark";
                bookmark.Fill = new NColorFill(NColor.Red);
                paragraph.Inlines.Add(bookmark);

                section.Blocks.Add(paragraph);
            }
        }
        /// <summary>
        /// Adds formatted text with image elements to the specified text block content
        /// </summary>
        /// <param name="content"></param>
        private void AddFormattedTextWithImagesToContent(NTextBlockContent content)
        {
            // adding a raster image with automatic size
            {
                NParagraph paragraph = new NParagraph();

                paragraph.Inlines.Add(new NTextInline("Raster image in its original size (125x100):"));
                paragraph.Inlines.Add(new NLineBreakInline());

                NImageInline imageInline = new NImageInline();
                imageInline.Image = NResources.Image_Artistic_FishBowl_jpg;
                paragraph.Inlines.Add(imageInline);

                content.Blocks.Add(paragraph);
            }


            // adding a raster image with specified preferred width and height
            {
                NParagraph paragraph = new NParagraph();

                paragraph.Inlines.Add(new NTextInline("Raster image with preferred width and height (80x60):"));
                paragraph.Inlines.Add(new NLineBreakInline());

                NImageInline imageInline = new NImageInline();

                imageInline.Image           = NResources.Image_Artistic_FishBowl_jpg;
                imageInline.PreferredWidth  = new NMultiLength(ENMultiLengthUnit.Dip, 80);
                imageInline.PreferredHeight = new NMultiLength(ENMultiLengthUnit.Dip, 60);

                paragraph.Inlines.Add(imageInline);

                content.Blocks.Add(paragraph);
            }

            // adding a metafile image with preferred width and height
            {
                NParagraph paragraph = new NParagraph();

                paragraph.Inlines.Add(new NTextInline("Metafile image with preferred width and height (125x100):"));
                paragraph.Inlines.Add(new NLineBreakInline());

                NImageInline imageInline = new NImageInline();
                imageInline.Image           = NResources.Image_FishBowl_wmf;
                imageInline.PreferredWidth  = new NMultiLength(ENMultiLengthUnit.Dip, 125);
                imageInline.PreferredHeight = new NMultiLength(ENMultiLengthUnit.Dip, 100);

                paragraph.Inlines.Add(imageInline);

                content.Blocks.Add(paragraph);
            }


            // adding a metafile image with preferred width and height
            {
                NParagraph paragraph = new NParagraph();

                paragraph.Inlines.Add(new NTextInline("Metafile image with preferred width and height (80x60):"));
                paragraph.Inlines.Add(new NLineBreakInline());

                NImageInline imageInline = new NImageInline();
                imageInline.Image           = NResources.Image_FishBowl_wmf;
                imageInline.PreferredWidth  = new NMultiLength(ENMultiLengthUnit.Dip, 80);
                imageInline.PreferredHeight = new NMultiLength(ENMultiLengthUnit.Dip, 60);

                paragraph.Inlines.Add(imageInline);

                content.Blocks.Add(paragraph);
            }
        }
示例#4
0
        protected override void PopulateRichText()
        {
            NSection section = new NSection();
            m_RichText.Content.Sections.Add(section);

            section.Blocks.Add(GetDescriptionBlock("Image Inlines", "The example shows how to add image inlines with altered preferred width and height.", 1));

            // adding a raster image with automatic size
            {
                NParagraph paragraph = new NParagraph();

                paragraph.Inlines.Add(new NTextInline("Raster image in its original size (125x100):"));
                paragraph.Inlines.Add(new NLineBreakInline());

                NImageInline imageInline = new NImageInline();
                imageInline.Image = NResources.Image_Artistic_FishBowl_jpg;
                paragraph.Inlines.Add(imageInline);

                section.Blocks.Add(paragraph);
            }

            // adding a raster image with specified preferred width and height
            {
                NParagraph paragraph = new NParagraph();

                paragraph.Inlines.Add(new NTextInline("Raster image with preferred width and height (250x200):"));
                paragraph.Inlines.Add(new NLineBreakInline());

                NImageInline imageInline = new NImageInline();

                imageInline.Image = NResources.Image_Artistic_FishBowl_jpg;
                imageInline.PreferredWidth = new NMultiLength(ENMultiLengthUnit.Dip, 250);
                imageInline.PreferredHeight = new NMultiLength(ENMultiLengthUnit.Dip, 200);

                paragraph.Inlines.Add(imageInline);

                section.Blocks.Add(paragraph);
            }

            // adding a metafile image with preferred width and height
            {
                NParagraph paragraph = new NParagraph();

                paragraph.Inlines.Add(new NTextInline("Metafile image with preferred width and height (125x100):"));
                paragraph.Inlines.Add(new NLineBreakInline());

                NImageInline imageInline = new NImageInline();
                imageInline.Image = NResources.Image_FishBowl_wmf;
                imageInline.PreferredWidth = new NMultiLength(ENMultiLengthUnit.Dip, 125);
                imageInline.PreferredHeight = new NMultiLength(ENMultiLengthUnit.Dip, 100);

                paragraph.Inlines.Add(imageInline);

                section.Blocks.Add(paragraph);
            }

            // adding a metafile image with preferred width and height
            {
                NParagraph paragraph = new NParagraph();

                paragraph.Inlines.Add(new NTextInline("Metafile image with preferred width and height (250x200):"));
                paragraph.Inlines.Add(new NLineBreakInline());

                NImageInline imageInline = new NImageInline();
                imageInline.Image = NResources.Image_FishBowl_wmf;
                imageInline.PreferredWidth = new NMultiLength(ENMultiLengthUnit.Dip, 250);
                imageInline.PreferredHeight = new NMultiLength(ENMultiLengthUnit.Dip, 200);

                paragraph.Inlines.Add(imageInline);

                section.Blocks.Add(paragraph);
            }
        }