diff --git a/HtmlRenderer.nupkg b/HtmlRenderer.nupkg
index 0b2804e23..90c579250 100644
Binary files a/HtmlRenderer.nupkg and b/HtmlRenderer.nupkg differ
diff --git a/README.md b/README.md
index 3c55b7bde..7a63925df 100644
--- a/README.md
+++ b/README.md
@@ -13,15 +13,20 @@ The library is **100% managed code** without any external dependencies, the only
1. 100% managed code.
3. No external dependencies.
3. Single and small dll (250K).
- 4. Supports .NET 2.0 and 3.0, 3.5, 4.0 client profile.
+ 4. Supports .NET 2.0 and 3.0, 3.5, 4.0 client profile, 4.5 or higher.
**What it is not**
*
-**Installing**
+**NuGet package install**
+ 1. PM> Install-Package HtmlRenderer.WinForms
+ 2. Or from NuGet UI
+
+**Manual install**
1. Download the binaries.
2. Reference the proper .NET release (2.0, 3.0, 3.5, 4.0, 4.5) in your project.
**Usage**
- 1. Drag-n-drop HtmlPanel, HtmlLabel or HtmlToolTip from the Toolbox.
- 2. Set the *Text* property with your html.
+ 1. Add HtmlRenderer to Visual Studio Toolbox (drag-drop the dll on it).
+ 2. Drag-n-drop HtmlPanel, HtmlLabel or HtmlToolTip from the Toolbox.
+ 3. Set the *Text* property with your html.
diff --git a/Source/Demo/DemoForm.cs b/Source/Demo/DemoForm.cs
index 0bde836c9..e79aea832 100644
--- a/Source/Demo/DemoForm.cs
+++ b/Source/Demo/DemoForm.cs
@@ -123,7 +123,9 @@ private void LoadSamples()
{
using (StreamReader sreader = new StreamReader(resourceStream, Encoding.Default))
{
- _samples[name] = sreader.ReadToEnd();
+ var html = sreader.ReadToEnd();
+ html = html.Replace("$$Release$$", _htmlPanel.GetType().Assembly.GetName().Version.ToString());
+ _samples[name] = html;
}
var node = new TreeNode(shortName);
diff --git a/Source/Demo/HtmlRenderer.Demo.csproj b/Source/Demo/HtmlRenderer.Demo.csproj
index 1dc779880..c3d246fb3 100644
--- a/Source/Demo/HtmlRenderer.Demo.csproj
+++ b/Source/Demo/HtmlRenderer.Demo.csproj
@@ -148,25 +148,25 @@
@@ -19,23 +19,23 @@
HTML Renderer Project
- Release 1.4.6.2
+ Release $$Release$$
Everything you see on this panel (see samples on the left) is custom-painted
- by the HTML Renderer. Including tables, images, links and videos.
- This project allows you can have the rich format power of HTML on you desktop applications
- without WebBrowser control and MSHTML.
- The library is 100% managed code without any external libraries dependencies,
- the only requirement is .NET 2.0 or higher.
+ by the HTML Renderer, including tables, images, links and videos.
+ This project allows you to have the rich format power of HTML on your desktop applications
+ without WebBrowser control or MSHTML.
+ The library is 100% managed code without any external dependencies, the only
+ requirement is .NET 2.0 or higher, including support for Client Profile.
HtmlToolTip - For ToolTip with rich html.diff --git a/Source/Demo/Samples/02.Text.htm b/Source/Demo/Samples/02.Text.htm new file mode 100644 index 000000000..49a5486e6 --- /dev/null +++ b/Source/Demo/Samples/02.Text.htm @@ -0,0 +1,183 @@ + + +For years, I (Jose) have been planning for a project like this. I prepared - my self quite well. I went through the entire CSS Level 2 specifiation along with + my self quite well. I went through the entire CSS Level 2 specification along with the HTML 4.01 specification.
One of the most interesting things I found is this: Drawing HTML is no more than - laying out a bunch of boxes with borders margins and paddings. Once you overpass + laying out a bunch of boxes with borders margins and padding's. Once you overpass this paradigm, everything else is to help the code actually place the boxes on the right place, and then paint the string each box contains.
@@ -29,10 +29,20 @@all of the code on the library is managed code and the methods it use to paint are quite basic. It draws lines, rectangles, curves and text. -
+
In October 2012 I (Arthur) was looking to replace the usage of WinForms WebBrowser - control by fully managed code... + control by something that can render complex html and have good performance and stability + characteristics. Obviously I was looking for fully managed solution preferably one that + I will have full control over. +
++ HTML Renderer project showed great promise but had significant performance issues, + lacked many features (primary text selection) and wasn't updated for more than 3 years. + Realizing there is no alternative I embraced the project making it my baby. +
++
++ + diff --git a/Source/Demo/Samples/04.Tables.htm b/Source/Demo/Samples/03.Tables.htm similarity index 100% rename from Source/Demo/Samples/04.Tables.htm rename to Source/Demo/Samples/03.Tables.htm diff --git a/Source/Demo/Samples/03.Text.htm b/Source/Demo/Samples/03.Text.htm deleted file mode 100644 index bb6f00c32..000000000 --- a/Source/Demo/Samples/03.Text.htm +++ /dev/null @@ -1,200 +0,0 @@ - - -Formatting +
++ You can use all the well known tags and CSS properties to format text, fonts and + colors. +
++
+- Colors, Colors, + Colors
+- Back colors, Back colors, Back colors
+- Font style, Font style, Font style, Font style, Font style
++ Lorem ipsum dolor sit amet, + consectetur adipiscing elit. Curabitur ornare mollis elit. Integer sagittis. + Fusce elementum commodo felis. Vivamus lacinia eleifend libero. + Donec lacus. Nam sit amet urna. Nullam nulla. Donec accumsan porta magna. + Mauris a dolor eu elit rutrum commodo. Nam + iaculis turpis non augue. Nullam lobortis egestas risus. Nulla elementum dolor ac + mauris. Ut tristique. In varius volutpat metus. Integer leo dolor, tristique a, + dignissim ac, iaculis eget, elit. + Donec arcu. +
+
+Custom fonts +
++ This is a custom font that is not installed on the system. +
+
+Alignment +
++ Simple paragraphs can be used to create a document. Alignment can be used as you + already know. +
+Left aligned +
++ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ornare mollis + elit. Integer sagittis. Fusce elementum commodo felis. Vivamus lacinia eleifend + libero. Donec lacus. Nam sit amet urna. Nullam nulla. Donec accumsan porta magna. + Mauris a dolor eu elit rutrum commodo. Nam iaculis turpis non augue. +
+Center aligned
++ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ornare mollis + elit. Integer sagittis. Fusce elementum commodo felis. Vivamus lacinia eleifend + libero. Donec lacus. Nam sit amet urna. Nullam nulla. Donec accumsan porta magna. + Mauris a dolor eu elit rutrum commodo. Nam iaculis turpis non augue. +
+Right aligned
++ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ornare mollis + elit. Integer sagittis. Fusce elementum commodo felis. Vivamus lacinia eleifend + libero. Donec lacus. Nam sit amet urna. Nullam nulla. Donec accumsan porta magna. + Mauris a dolor eu elit rutrum commodo. Nam iaculis turpis non augue. +
+Justifed
++ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ornare mollis + elit. Integer sagittis. Fusce elementum commodo felis. Vivamus lacinia eleifend + libero. Donec lacus. Nam sit amet urna. Nullam nulla. Donec accumsan porta magna. + Mauris a dolor eu elit rutrum commodo. Nam iaculis turpis non augue. +
+
+Breakable lines
+ http://www.google.com/sjkdhgfasdfgfg/asdfadfsgaefg/adfgafdgadfg/asdfgaedfgsdfg/dasfgasfdgasdfg/adfgadfgasfdg/adfsgafgafg/afdgaddfgadfg/afsdgafdgaddfg/afsdgafgadqfdgaeddfg +
+Transparent text
++ Lorem ipsum dolor sit amet, consectetur adipiscing elit +
+
+Preformatted text
++ The preformatted text is fully supported, like this C# code demo: +
++//Example of code using preformatted text +public class HelloWorld +{ + public HelloWorld() + { + MessageBox.Show("Hello World"); + } +}+
+
+Lists
++ Both UL and OL tags are supported, though, all the CSS properties related with lists + are not still fully supported.. The maximum you will get is bullets and numbers. + Image bullets and better numbering support may be added by next release. +
+Unordered list +
++
+- Item one
+- Item two +
++
+- Sub item one
+- Sub item two
++
+- Sub-sub item two
+- Sub-sub item two
+- Item three
+- Item four
+Ordered list +
++
+- Item one
+- Item two
+- Item three
+List nesting
++
+- Item one
+- Item two
+- Item three +
++
+- Item one
+- Item two
+- Item three
+- Item four
+- Item five
+
+
+Right to left direction +
++ It may not behave exactly like the specification says, but it can be useful if you + use it for right-to-left languages. All you have to do is to alter the
+direction+ property like this: +.myparagraph { direction:rtl; }+Left aligned +
++ בניגוד לטענה הרווחת, Lorem Ipsum אינו סתם טקסט רנדומלי. יש לו שורשים וחלקים מתוך הספרות הלטינית הקלאסית מאז 45 לפני הספירה. מה שהופך אותו לעתיק מעל 2000 שנה. ריצ'רד מקלינטוק, פרופסור לטיני בקולג' של המפדן-סידני בורג'יניה, חיפש את אחת המילים המעורפלות ביותר בלטינית - consectetur - מתוך פסקאות של Lorem Ipsum ודרך ציטוטים של המילה מתוך הספרות הקלאסית, הוא גילה מקור בלתי ניתן לערעור. Lorem Ipsum מגיע מתוך מקטע 1.10.32 ו- 1.10.33 של "de Finibus Bonorum et Malorum" (הקיצוניות של הטוב והרע) שנכתב על ידי קיקרו ב-45 לפני הספירה. ספר זה הוא מאמר על תאוריית האתיקה, שהיה מאוד מפורסם בתקופת הרנסנס. השורה הראשונה של "Lorem ipsum dolor sit amet", שמופיעה בטקסטים של Lorem Ipsum, באה משורה במקטע 1.10.32 +
+Center aligned +
++ בניגוד לטענה הרווחת, Lorem Ipsum אינו סתם טקסט רנדומלי. יש לו שורשים וחלקים מתוך הספרות הלטינית הקלאסית מאז 45 לפני הספירה. מה שהופך אותו לעתיק מעל 2000 שנה. ריצ'רד מקלינטוק, פרופסור לטיני בקולג' של המפדן-סידני בורג'יניה, חיפש את אחת המילים המעורפלות ביותר בלטינית - consectetur - מתוך פסקאות של Lorem Ipsum ודרך ציטוטים של המילה מתוך הספרות הקלאסית, הוא גילה מקור בלתי ניתן לערעור. Lorem Ipsum מגיע מתוך מקטע 1.10.32 ו- 1.10.33 של "de Finibus Bonorum et Malorum" (הקיצוניות של הטוב והרע) שנכתב על ידי קיקרו ב-45 לפני הספירה. ספר זה הוא מאמר על תאוריית האתיקה, שהיה מאוד מפורסם בתקופת הרנסנס. השורה הראשונה של "Lorem ipsum dolor sit amet", שמופיעה בטקסטים של Lorem Ipsum, באה משורה במקטע 1.10.32 +
+Right aligned +
++ בניגוד לטענה הרווחת, Lorem Ipsum אינו סתם טקסט רנדומלי. יש לו שורשים וחלקים מתוך הספרות הלטינית הקלאסית מאז 45 לפני הספירה. מה שהופך אותו לעתיק מעל 2000 שנה. ריצ'רד מקלינטוק, פרופסור לטיני בקולג' של המפדן-סידני בורג'יניה, חיפש את אחת המילים המעורפלות ביותר בלטינית - consectetur - מתוך פסקאות של Lorem Ipsum ודרך ציטוטים של המילה מתוך הספרות הקלאסית, הוא גילה מקור בלתי ניתן לערעור. Lorem Ipsum מגיע מתוך מקטע 1.10.32 ו- 1.10.33 של "de Finibus Bonorum et Malorum" (הקיצוניות של הטוב והרע) שנכתב על ידי קיקרו ב-45 לפני הספירה. ספר זה הוא מאמר על תאוריית האתיקה, שהיה מאוד מפורסם בתקופת הרנסנס. השורה הראשונה של "Lorem ipsum dolor sit amet", שמופיעה בטקסטים של Lorem Ipsum, באה משורה במקטע 1.10.32 +
+Justifed +
++ בניגוד לטענה הרווחת, Lorem Ipsum אינו סתם טקסט רנדומלי. יש לו שורשים וחלקים מתוך הספרות הלטינית הקלאסית מאז 45 לפני הספירה. מה שהופך אותו לעתיק מעל 2000 שנה. ריצ'רד מקלינטוק, פרופסור לטיני בקולג' של המפדן-סידני בורג'יניה, חיפש את אחת המילים המעורפלות ביותר בלטינית - consectetur - מתוך פסקאות של Lorem Ipsum ודרך ציטוטים של המילה מתוך הספרות הקלאסית, הוא גילה מקור בלתי ניתן לערעור. Lorem Ipsum מגיע מתוך מקטע 1.10.32 ו- 1.10.33 של "de Finibus Bonorum et Malorum" (הקיצוניות של הטוב והרע) שנכתב על ידי קיקרו ב-45 לפני הספירה. ספר זה הוא מאמר על תאוריית האתיקה, שהיה מאוד מפורסם בתקופת הרנסנס. השורה הראשונה של "Lorem ipsum dolor sit amet", שמופיעה בטקסטים של Lorem Ipsum, באה משורה במקטע 1.10.32 +
+++
-- - diff --git a/Source/Demo/Samples/04.Links.htm b/Source/Demo/Samples/04.Links.htm new file mode 100644 index 000000000..8485a0914 --- /dev/null +++ b/Source/Demo/Samples/04.Links.htm @@ -0,0 +1,68 @@ + + +- Formatting -
-- You can use all the well known tags and CSS properties to format text, fonts and - colors. -
--
-- Colors, Colors, - Colors
-- Back colors, - Back colors, Back colors
-- Font style, - Font style, Font style, - Font style, Font style
-- Lorem ipsum dolor sit amet, - consectetur adipiscing elit. Curabitur ornare mollis elit. Integer sagittis. - Fusce elementum commodo felis. Vivamus lacinia eleifend libero. - Donec lacus. Nam sit amet urna. Nullam nulla. Donec accumsan porta magna. - Mauris a dolor eu elit rutrum commodo. Nam - iaculis turpis non augue. Nullam lobortis egestas risus. Nulla elementum dolor ac - mauris. Ut tristique. In varius volutpat metus. Integer leo dolor, tristique a, - dignissim ac, iaculis eget, elit. - Donec arcu.
-
-- Custom fonts -
-- This is a custom font that is not installed on the system. -
-
-- Alignment -
-- Simple paragraphs can be used to create a document. Alignment can be used as you - already know. -
-- Left aligned -
-- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ornare mollis - elit. Integer sagittis. Fusce elementum commodo felis. Vivamus lacinia eleifend - libero. Donec lacus. Nam sit amet urna. Nullam nulla. Donec accumsan porta magna. - Mauris a dolor eu elit rutrum commodo. Nam iaculis turpis non augue.
-- Center aligned
-- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ornare mollis - elit. Integer sagittis. Fusce elementum commodo felis. Vivamus lacinia eleifend - libero. Donec lacus. Nam sit amet urna. Nullam nulla. Donec accumsan porta magna. - Mauris a dolor eu elit rutrum commodo. Nam iaculis turpis non augue.
-- Right aligned
-- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ornare mollis - elit. Integer sagittis. Fusce elementum commodo felis. Vivamus lacinia eleifend - libero. Donec lacus. Nam sit amet urna. Nullam nulla. Donec accumsan porta magna. - Mauris a dolor eu elit rutrum commodo. Nam iaculis turpis non augue.
-- Justifed
-- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ornare mollis - elit. Integer sagittis. Fusce elementum commodo felis. Vivamus lacinia eleifend - libero. Donec lacus. Nam sit amet urna. Nullam nulla. Donec accumsan porta magna. - Mauris a dolor eu elit rutrum commodo. Nam iaculis turpis non augue.
-
-Breakable lines
- http://www.google.com/sjkdhgfasdfgfg/asdfadfsgaefg/adfgafdgadfg/asdfgaedfgsdfg/dasfgasfdgasdfg/adfgadfgasfdg/adfsgafgafg/afdgaddfgadfg/afsdgafdgaddfg/afsdgafgadqfdgaeddfg -
-- Preformatted text
-- The preformatted text is fully supported, like this C# code demo:
--//Example of code using preformatted text -public class HelloWorld -{ - public HelloWorld() - { - MessageBox.Show("Hello World"); - } -}-
-
-- Lists
-- Both UL and OL tags are supported, though, all the CSS properties related with lists - are not still fully supported.. The maximum you will get is bullets and numbers. - Image bullets and better numbering support may be added by next release.
-- Unordered list -
--
-- Item one
-- Item two -
--
-- Sub item one
-- Sub item two
--
-- Sub-sub item two
-- Sub-sub item two
-- Item three
-- Item four
-- Ordered list -
--
-- Item one
-- Item two
-- Item three
-- List nesting
--
-- Item one
-- Item two
-- Item three -
--
-- Item one
-- Item two
-- Item three
-- Item four
-- Item five
-
-
-- Right to left direction -
-- It may not behave exactly like the specification says, but it can be useful if you - use it for right-to-left languages. All you have to do is to alter the
-direction- property like this:.myparagraph { direction:rtl; }-- Left aligned -
-- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ornare mollis - elit. Integer sagittis. Fusce elementum commodo felis. Vivamus lacinia eleifend - libero. Donec lacus. Nam sit amet urna. Nullam nulla. Donec accumsan porta magna. - Mauris a dolor eu elit rutrum commodo. Nam iaculis turpis non augue.
-- Center aligned -
-- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ornare mollis - elit. Integer sagittis. Fusce elementum commodo felis. Vivamus lacinia eleifend - libero. Donec lacus. Nam sit amet urna. Nullam nulla. Donec accumsan porta magna. - Mauris a dolor eu elit rutrum commodo. Nam iaculis turpis non augue.
-- Right aligned -
-- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ornare mollis - elit. Integer sagittis. Fusce elementum commodo felis. Vivamus lacinia eleifend - libero. Donec lacus. Nam sit amet urna. Nullam nulla. Donec accumsan porta magna. - Mauris a dolor eu elit rutrum commodo. Nam iaculis turpis non augue.
-- Justifed -
-- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ornare mollis - elit. Integer sagittis. Fusce elementum commodo felis. Vivamus lacinia eleifend - libero. Donec lacus. Nam sit amet urna. Nullam nulla. Donec accumsan porta magna. - Mauris a dolor eu elit rutrum commodo. Nam iaculis turpis non augue.
---
++ + diff --git a/Source/Demo/Samples/05.Images.htm b/Source/Demo/Samples/05.Images.htm index 6a58648b5..bd76e5b3a 100644 --- a/Source/Demo/Samples/05.Images.htm +++ b/Source/Demo/Samples/05.Images.htm @@ -3,89 +3,100 @@+ HTML Renderer supports all html hyperlinks specification and code interception. +
++
URI href
+ Any valid URI path will activate the default internet browser. +
+ Check the context menu options on the link as well by right clicking on it. +
+ This is a URI link to HTML Renderer (href="https://htmlrenderer.codeplex.com/") + ++
File path href
+ Any file system path, It will be started as if you typed it on the Run Windows dialog. +
+ This is a link to hard drive(href="C:\")+ ++
Anchors href
+ Link to elements on the page using element id will scroll to that element so it will be at the top. +
+ This is a link to anchor at the bottom of the page(href="#anchor")+ ++
Intercept
+ Any link click can be intercepted by LinkClicked event, analyzed by link 'href' value or + other attributes of the link element and cancel the default processing those allowing custom handling. +
+ This link is intercepted to show message box Hello! (href="SayHello") + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
++ Anchor here +
+
- Of course, there's the capability of displaying images. In this release, images - lack of the expected alignment features to behave just as expected on an HTML context, - but they will do just fine for inline contexts, tables and some others.
-- Inserting images + HTML Renderer supports
imgtag as well as CSSbackground-imageproperty. +
+ Image data can be provided by URI, file path, base64 encoded and code interception. + + + +Loading image
- We all know that the
-srcattribute of theimgHTML tag - can be a relative or absolute path to an image on the same or any other server. - Here things are slightly different. Images can come from other sources:-
-- File Paths: If you place a path to a file, the Renderer will try to load - it using
-Image.FromFile- Static Properties: Obtains the image from a static property that returns - an
-Imageobject- Static Methods: Obtains the image from a static method that takes no arguments - and returns an
-Image- Positioning Images -
+URI
+- You can use Images anyway you like, apply borders margin and padding as for any - other box. +
File path
+ ++
Base64 encoded
- Some examples of image positioning: +
Intercept
+ +img tag
++ You can use Images anyway you like, apply borders margin and padding as for any + other box. +
+ Limitation +
+ Imagealignattribute and CSSfloatproperty are not yet supported. ++ +
- - Just an image: + Just an image: ![]()
- - Image with border and background: + Image with border and background: ![]()
- - Stretched Image: + Stretched Image: ![]()
- - Huge padding and border: + Huge padding and border: ![]()
- - Image in line + Image in line with the text
Background images +
+