彩票走势图

CodeHighlighter代码高亮控件的使用方法

原创|其它|编辑:郝浩|2012-10-11 11:46:05.000|阅读 985 次

概述:具体介绍了CodeHighlighter 代码高亮控件的使用方法。

# 慧都年终大促·界面/图表报表/文档/IDE等千款热门软控件火热促销中 >>

1、先下载CodeHighlighter

2、在程序中添加 ActiproSoftware.CodeHighlighter.Net20.dll 
ActiproSoftware.Shared.Net20.dll CodeHighlighterTest.dll

三个dll的引用

3、将Languages 和 image 文件夹 拷贝到程序目录中

4、在web.config中添加

<configuration>
<configSections>
<section name="CodeHighlighter" type="ActiproSoftware.CodeHighlighter.CodeHighlighterConfigurationSectionHandler, ActiproSoftware.CodeHighlighter.Net20"/>
</configSections>

<CodeHighlighter>
<cache languageTimeout="3"/>
<keywordLinking enabled="true" target="_blank" defaultKeywordCollectionKey="ActiproKeywords">
<keywordCollection key="ActiproKeywords">
<explicitKeyword tokenKey="IdentifierToken" patternValue="Actipro" url="//www.actiprosoftware.com" caseSensitive="false"/>
<explicitKeyword tokenKey="IdentifierToken" patternValue="CodeHighlighter" url="//www.CodeHighlighter.com" caseSensitive="false"/>
</keywordCollection>
</keywordLinking>
<languages>
<language key="Assembly" definitionPath="~/Languages/Lexers/ActiproSoftware.Assembly.xml"/>
<language key="BatchFile" definitionPath="~/Languages/Lexers/ActiproSoftware.BatchFile.xml"/>
<language key="C#" definitionPath="~/Languages/Lexers/ActiproSoftware.CSharp.xml"/>
<language key="CSS" definitionPath="~/Languages/Lexers/ActiproSoftware.CSS.xml"/>
<language key="HTML" definitionPath="~/Languages/Lexers/ActiproSoftware.HTML.xml"/>
<language key="INIFile" definitionPath="~/Languages/Lexers/ActiproSoftware.INIFile.xml"/>
<language key="Java" definitionPath="~/Languages/Lexers/ActiproSoftware.Java.xml"/>
<language key="JScript" definitionPath="~/Languages/Lexers/ActiproSoftware.JScript.xml"/>
<language key="Lua" definitionPath="~/Languages/Lexers/ActiproSoftware.Lua.xml"/>
<language key="MSIL" definitionPath="~/Languages/Lexers/ActiproSoftware.MSIL.xml"/>
<language key="Pascal" definitionPath="~/Languages/Lexers/ActiproSoftware.Pascal.xml"/>
<language key="Perl" definitionPath="~/Languages/Lexers/ActiproSoftware.Perl.xml"/>
<language key="PHP" definitionPath="~/Languages/Lexers/ActiproSoftware.PHP.xml"/>
<language key="PowerShell" definitionPath="~/Languages/Lexers/ActiproSoftware.PowerShell.xml"/>
<language key="Python" definitionPath="~/Languages/Lexers/ActiproSoftware.Python.xml"/>
<language key="SQL" definitionPath="~/Languages/Lexers/ActiproSoftware.SQL.xml"/>
<language key="VB.NET" definitionPath="~/Languages/Lexers/ActiproSoftware.VBDotNet.xml"/>
<language key="VBScript" definitionPath="~/Languages/Lexers/ActiproSoftware.VBScript.xml"/>
<language key="XAML" definitionPath="~/Languages/Lexers/ActiproSoftware.XAML.xml"/>
<language key="XML" definitionPath="~/Languages/Lexers/ActiproSoftware.XML.xml"/>
</languages>
<lineNumberMargin foreColor="Teal" paddingCharacter=" " visible="true"/>
<outlining enabled="true" imagesPath="~/Images/OutliningIndicators/"/>
<spacesInTabs count="4"/>
</CodeHighlighter>
</configuration>

5、在使用页的顶部 注册

增加下面的代码

<%@ Register TagPrefix="CH" Namespace="ActiproSoftware.CodeHighlighter" Assembly="ActiproSoftware.CodeHighlighter.Net20" %>

6、添加控件

<pre >
<CH:CodeHighlighter runat="server" OutliningEnabled="true" ID="CssCodeHighlighter"
LineNumberMarginVisible="true">
</CH:CodeHighlighter></pre>

7、控件赋值

this.CssCodeHighlighter.LanguageKey = ds.Tables[0].Rows[0]["codetype"].ToString().Trim();
this.CssCodeHighlighter.Text = ds.Tables[0].Rows[0]["Code"].ToString().Trim();

 


标签:

本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@capbkgr.cn

文章转载自:forrest23的专栏-CSDN

为你推荐

  • 推荐视频
  • 推荐活动
  • 推荐产品
  • 推荐文章
  • 慧都慧问
扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP