代码改变世界

代码高亮插件 c#(asp.net)

2009-11-24 22:04  曾祥展  阅读(1772)  评论(0编辑  收藏
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;
 } 
 
gl 
 
下载