Ai
2 Star 0 Fork 1

codeman35/CodeTemplate

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
FormShowCode.cs 3.49 KB
一键复制 编辑 原始数据 按行查看 历史
codeman35 提交于 2016-01-05 07:07 +08:00 . no commit message
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using LTP.TextEditor;
using System.IO;
namespace AtfutureCodeMachine
{
public partial class FormShowCode : Form
{
public FormShowCode()
{
InitializeComponent();
this.Shown += new EventHandler(FormShowCode_Shown);
this.tabControl1.DoubleClick += new EventHandler(tabControl1_DoubleClick);
}
void tabControl1_DoubleClick(object sender, EventArgs e)
{
if (tabControl1.SelectedIndex != tabControl1.TabCount - 1)
{
TextEditorControl codeview = this.tabControl1.SelectedTab.Controls[0] as TextEditorControl;
string vm = this.tabControl1.SelectedTab.Tag.ToString();
FormMain.g_code[vm] = ViewTemplate.ParseVm(vm);
codeview.Text = FormMain.g_code[vm];
}
}
void FormShowCode_Shown(object sender, EventArgs e)
{
//移除默认的
this.tabControl1.TabPages.RemoveAt(0);
this.tabControl1.TabPages.RemoveAt(0);
foreach (string s in FormMain.g_code.Keys)
{
this.tabControl1.TabPages.Add(s.ToUpper());
TextEditorControl codeview = new TextEditorControl();
codeview.Dock = DockStyle.Fill;
this.tabControl1.TabPages[this.tabControl1.TabCount - 1].Controls.Add(codeview);
this.tabControl1.TabPages[this.tabControl1.TabCount - 1].Tag = s.ToUpper();
string strExt = s.Split('.')[1].ToLower();
if (strExt == "vm" || strExt == "htm" || strExt == "html" || strExt == "aspx" || strExt == "ashx") codeview.Language = TextEditorControlBase.Languages.HTML;
if (strExt == "hbm" || strExt == "xml") codeview.Language = TextEditorControlBase.Languages.XML;
if (strExt == "sql") codeview.Language = TextEditorControlBase.Languages.SQL;
if (strExt == "vb") codeview.Language = TextEditorControlBase.Languages.VBNET;
if (strExt == "js") codeview.Language = TextEditorControlBase.Languages.JavaScript;
if (strExt == "java") codeview.Language = TextEditorControlBase.Languages.Java;
if (strExt == "cs") codeview.Language = TextEditorControlBase.Languages.CSHARP;
codeview.Text = FormMain.g_code[s.ToUpper()];
}
//加载说明
TextEditorControl te = new TextEditorControl();
te.Dock = DockStyle.Fill;
this.tabControl1.TabPages.Add("Help");
this.tabControl1.TabPages[this.tabControl1.TabCount - 1].Controls.Add(te);
te.Language = TextEditorControlBase.Languages.CSHARP;
using (StreamReader sr = new StreamReader(Path.Combine(Application.StartupPath, "help.vm"),
Encoding.GetEncoding("gb2312")))
{
te.Text = sr.ReadToEnd();
}
}
/// <summary>
/// 返回值
/// </summary>
public string Value
{
set
{
//this.richTextBox1.Text = value;
}
}
private void button1_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/lxwcode/CodeTemplate.git
git@gitee.com:lxwcode/CodeTemplate.git
lxwcode
CodeTemplate
CodeTemplate
master

搜索帮助