csdn高亮也是这个
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
CodeHighlighterConfiguration config = ConfigurationManager.GetSection("codeHighlighter") as CodeHighlighterConfiguration;
string[] keys = new string[config.LanguageConfigs.Keys.Count];
config.LanguageConfigs.Keys.CopyTo(keys, 0);
Array.Sort(keys);
foreach (string key in keys)
{
LanguageDropDownList.Items.Add(key);
}
LanguageDropDownList.SelectedIndex = LanguageDropDownList.Items.IndexOf(LanguageDropDownList.Items.FindByText("C#"));
}
}
protected void HighlightButton_Click(object sender, EventArgs e)
{
// HighlightButton.Enabled = false;
FileSizeLabel.Text = CodeTextBox.Text.Length.ToString();
OutputTextBox.Text =null;
Highlighter.LanguageKey = LanguageDropDownList.SelectedItem.Text;
Highlighter.OutliningEnabled = OutliningEnabledCheckBox.Checked;
Highlighter.LineNumberMarginVisible = LineNumberMarginVisibleCheckBox.Checked;
Highlighter.Text = CodeTextBox.Text;
ResultsPanel.Visible = true;
}
protected void CodeHighlighter_PostRender(object sender, EventArgs e)
{
OutputTextBox.Text = Highlighter.Output;
}
下载