|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using SyntaxEngineClass;
namespace SyntaxEngineDemo
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void buttonClose_Click(object sender, EventArgs e)
{
Close();
}
private bool FHasRtf = false; // �Ƿ�����Ѿ����ɵ�Rtf
private bool FHasHtml = false; // �Ƿ�����Ѿ����ɵ�Html
private void textBox1_TextChanged(object sender, EventArgs e)
{
FHasRtf = false;
FHasHtml = false;
}
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e)
{
CSharpEngine vCSharpEngine;
CSharpHighlight vCSharpHighlight;
switch (((TabControl)sender).SelectedIndex)
{
case 1: //rtf
if (FHasRtf) return;
vCSharpEngine = new CSharpEngine();
vCSharpEngine.Analyze(textBox1.Text);
vCSharpHighlight = new CSharpHighlight(vCSharpEngine, new Font("Courier New", 10));
richTextBox1.Rtf = vCSharpHighlight.MakeRtf();
FHasRtf = true;
break;
case 2: //html
if (FHasHtml) return;
vCSharpEngine = new CSharpEngine();
vCSharpEngine.Analyze(textBox1.Text);
vCSharpHighlight = new CSharpHighlight(vCSharpEngine, new Font("Courier New", 10));
webBrowser1.DocumentText = vCSharpHighlight.MakeHtml();
FHasHtml = true;
break;
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.