HTML parser on Windows Mobile

HTML parser on Windows Mobile

Matjaž Prtenjak proposed this HTML parser on mobile devices and the original purpose of displaying it on HTML Label is to be able to change the text content and position, font size, font color, etc. of some controls on the interface in real time. The authorwrote an HTML parserbased on Jeff Heaton's " Parsing HTML in Microsoft C# " to make it more compact and suitable for use on mobile platforms.

  The author provides the source code of a control and the source code of the control using Demo. The method of using the control is also very simple. Just create a new project with visual studio, add the control source code HTMLLabel.cs and HTMLParser.cs, and compile it. Using this HTML control, we can achieve the following functions:

1. Show some simple HTML code with tags such as <b>, <i>, <u>, <pre>, <br>, <font> and <p>. In addition, it also supports < label>Mark.

2. Replace many different < label> tags, or combine them together.

3. Shorten InitializeComponent()the execution time of the function.

4. There are Clickevents, which are not available in .NET CF.

  Explain some HTML tags as follows: < b> means bold; <i> means italic; <u> means underline; <p> means paragraph, and its attributes alignindicate how to align it; <font> means font, and nameattribute means font type. ,sizeAttribute means font. The size colorindicates the font color; < pre> indicates the connection above.

  Take a look at the effect of font analysis, the following HTML code:

Code
 <font size='8' name='Tahoma' color='red'>Tahoma, 8, red</font>
 
 <font size='12' name='Courier new' color='blue'>Courier new, 12, blue</font>
 
 <font size='8' name='Tahoma' color='green'>Tahoma, 8, green, <b>bold</b></font>
 

  The running effect is shown in Figure 1 below:

Figure 1: Font running effect

  The HTML code of the alignment is as follows:

Code
 <p align='left'>left</p>
 
 <p align='center'>center</p>
 
 <p align='right'>right</p>
 

  The effect is shown in Figure 2:

Figure 2: Alignment effect

  In addition, the HTML code marked with label is as follows:

Code
 <font size='{0}'>
 
 This text box <label id='TextBox1' width='{1}' height='{2}'> will be positioned on the right place even if text changes. 
 
 So as this <label id='Button1' width='{3}' height='{4}'> and this <label id='Button2' width='{5}' height='{6}'> button . 
 
 <font color='red'>The value written in text box will be visible <b><label id='outText' width='70'></b> here.</font>
 
 </font>
 

  We can also modify the content in its label and refresh it in real time, as shown in Figure 3 below:

Figure 3: Label rendering

  To complete the study in which the code, we can go here to view and download: An HTML at The the .NET CF for the Label .

Reference link:

An HTML Label for the .NET CF

'Parsing HTML in Microsoft C#'

Reference: https://cloud.tencent.com/developer/article/1018106 HTML parser on Windows Mobile-Cloud + Community-Tencent Cloud