5,696,576 members and growing! (17,827 online)
Email Password   helpLost your password?
Desktop Development » Miscellaneous » Miscellaneous Controls     Intermediate

Simple WebControl to display Unicode tables

By Horia Tudosie

Whenever you need a Unicode character, drop this control on a form.
C#.NET 1.0, .NET 1.1, NT4, Win2K, WinXP, Windows, .NET, ASP.NET, Visual Studio, VS.NET2002, VS.NET2003, Dev

Posted: 21 Sep 2004
Updated: 21 Sep 2004
Views: 24,565
Bookmarked: 9 times
Announcements
Loading...



Search    
Advanced Search
Sitemap
11 votes for this Article.
Popularity: 3.98 Rating: 3.83 out of 5
1 vote, 9.1%
1
1 vote, 9.1%
2
1 vote, 9.1%
3
0 votes, 0.0%
4
8 votes, 72.7%
5

\u2536

Introduction

Ever wondered how the Unicode table looks like? Ever needed a special graphical character to simplify your graphical design? Want to know which alphabets are registered with your font?

Then here is a simple control that you may drop on a Web page to find it out!

Using the code

This code has been done with minimum effort. You will find inside neither comments, nor descriptions or designer attributes.

To register it on the Toolbox, download the code and expand in a new folder, create a blank solution, include this project, and build. Then create (or use) a Web application, go to the main form (just to have the Toolbox enabled), open the General tab and right-click inside. From the pop-up menu, click the Add/Remove Items... Then, click the Browse button and navigate to the Codes.dll file (in a folder like .../Bin/Debug). Select that file, accept, and the control should come alive in the Toolbox.

Properties

To simplify the usage of the control, I have considered the long time it needs for rendering the entire page. I have added so, properties to limit the number of columns and rows: ColFrom, ColTo, RowFrom and RowTo with defaults from 0 to 255 (including).

There is also a property for generating hints. When selected, this option produces a link to each char in the table with a tool tip showing the Unicode in the form \u2725. You may want to deactivate it when you desire to print the table on printer. Then, I suggest using also ColFrom and ColTo for limiting the table in the page-width limits.

How it works

Excepting properties and their defaults, the entire code is written in the Render overridden method. Here, I'm just generating a table with a header displaying the lower byte of the Unicode, and the first column - the higher byte.

Worth mentioning that in order to place the table at run time in the same position as at design time, I had to include code to generate the style of the table:

output.Write("<Table style=\"Z-INDEX: 107; POSITION: absolute; "+
  "LEFT: "+Style["LEFT"]+"; TOP: "+Style["TOP"]+
  "\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\" bgcolor" + 
  "=\"Lime\" ID="Table1"><TR><TD> </TD>");

And finally, to generate the content of each cell - with or without hints - the code is:

output.Write("<TD bgcolor=\"White\">");
if (DoHints)
  output.Write(string.Format("<A HREF=\"\" TITLE=\"\\u{0:x2}{1:x2}\">{2:c1}" +
                             "</a></td>",i,j,(Char)(256*i+j)));
else
  output.Write(string.Format("{0:c1}</td>",(Char)(256*i+j)));

Enjoy!

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Horia Tudosie


Horia Tudosie is Master of Sciences from the Polytechnic University of Bucharest - Computer Sciences.
Horia came in Canada in 1994 and works in US since 2003.
He was working with various peculiar languages as Delphi and Forth, but mainly with C, C++ and C#.

Occupation: Web Developer
Location: Canada Canada

Other popular Miscellaneous articles:

Article Top
Sign Up to vote for this article
You must Sign In to use this message board.
FAQ FAQ Noise ToleranceSearch Search Messages 
 Layout  Per page   
 Msgs 1 to 3 of 3 (Total in Forum: 3) (Refresh)FirstPrevNext
QuestionIt's usefull,butmembervzoltan3:23 28 Jul '08  
GeneralCodes.htmlmemberViktor Sklyar23:45 11 Apr '06  
GeneralRe: Codes.htmlmemberHoria Tudosie4:46 12 Apr '06  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 21 Sep 2004
Editor: Smitha Vijayan
Copyright 2004 by Horia Tudosie
Everything else Copyright © CodeProject, 1999-2008
Web15 | Advertise on the Code Project