Click here to Skip to main content
Licence CPOL
First Posted 17 Apr 2009
Views 10,831
Downloads 201
Bookmarked 14 times

Code Colorizer with Silverlight 2 & C#

By Mohammad Dayyan | 5 May 2009
Colorize C# & VB codes

1

2
2 votes, 50.0%
3

4
2 votes, 50.0%
5
4.33/5 - 4 votes
μ 4.33, σa 2.02 [?]

Introduction

CodeColorizer is a Silverlight 2 application to colorize codes for using in web logs or websites.
You can colorize C# and VB codes.
CodeColorizer generates valid XHTML codes, but if you're using some codes with syntax errors, probably it causes generating invalid XHTML codes.

Using the Application

Before using: If you're writing something in arbitrary CSS class name's textbox, you have to define it in your CSS codes.
For example, I recommend the following CSS class:

<style type="text/css">
<!--
.pre{
	font: 400 12px consolas,'Courier New',courier,monospace;
	width:100%; 
	margin: 0; 
	min-height: 1.2em; 
	direction:ltr;
}
-->
</style>

Using this option causes CodeColorizer to generate a shorter code.

Let's see some results of the application:

  • Striped = false;
  • C# = true;
  • Line Numbers = false;
  • Add the default Styles within Pre tags = true;
  • Add Pre Tags = true;
  • Add background color to the pre tag = true;
  • TextBoxColor = "ffecd0";

  • Striped = true;
  • C# = true;
  • Line Numbers = false;
  • Add the default Styles within Pre tags = true;

  • Striped = true;
  • C# = true;
  • Line Numbers = true;
  • Add the default Styles within Pre tags = true;

Finally

Probably there are some bugs or errors in the application. I would appreciate if you post them. Thanks!

History

  • 18th April, 2009: First post
  • 21st April, 2009: Updated demo and source files
  • 5th May, 2009: Updated demo and source files

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Mohammad Dayyan



Iran (Islamic Republic Of) Iran (Islamic Republic Of)

Member


Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
GeneralColoriser's use in web pages PinmemberDmitri Nesteruk18:17 18 Apr '09  
GeneralRe: Coloriser's use in web pages [modified] PinmemberMohammad Dayyan2:38 19 Apr '09  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120210.1 | Last Updated 5 May 2009
Article Copyright 2009 by Mohammad Dayyan
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid