回复 25# 小白龙
那就编译成32位的,用自带的C#编译器试了下,能成功编译成dll
编译编译命令为(csc改成自己系统的csc路径)- csc /r:EasyScintilla.dll /r:ScintillaNET.dll /target:library "new 1"
复制代码 代码文件"new 1"跟 EasyScintilla.dll 和 ScintillaNET.dll 放在同一文件夹(只有这3个文件)
还有代码文件改了下,看下面的- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using EasyScintilla.Stylers;
- using EasyScintilla;
-
- using System.IO;
- using System.Reflection;
-
- namespace ExampleProject
- {
- public partial class Form1 : Form
- {
-
- public EasyScintilla.SimpleEditor editor;//编辑器声明
- public System.Windows.Forms.Button theButton;//按钮声明
- public String thertStr; //返回字符串声明
-
- ///<summary>
- /// Required designer variable.
- /// </summary>
- private System.ComponentModel.IContainer components = null;
-
- /// <summary>
- /// Clean up any resources being used.
- ///重定义Form1释放函数
- /// </summary>
- /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- //定义Form1关闭事件函数,用于关闭时储存编辑器文本
- private void Form1_Closing(object sender, EventArgs e){thertStr=editor.Text;}
-
- //Form1构造函数
- public Form1()
- {
- InitializeComponent();//调用初始化函数
- }
-
- #region Windows Form Designer generated code
-
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///初始化函数定义
- /// </summary>
- private void InitializeComponent()
- {
- this.editor = new EasyScintilla.SimpleEditor();//创建编辑器
- this.theButton = new System.Windows.Forms.Button();//创建按钮
- this.SuspendLayout();
-
- //
- // editor设置
- //
- this.editor.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.editor.IndentationGuides = ScintillaNET.IndentView.LookBoth;
- this.editor.Location = new System.Drawing.Point(12, 12);
- this.editor.Name = "editor";
- this.editor.Size = new System.Drawing.Size(854, 603);
- this.editor.Styler = null;
- this.editor.TabIndex = 0;
-
- //
- // 按钮设置
- //
- this.theButton.Size=new System.Drawing.Size(100, 21);
- this.theButton.Location=new System.Drawing.Point(12, 621);
- this.theButton.Name="button1";
- this.theButton.Text="OK";
-
- //
- // Form1设置
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(878, 656);
- this.Controls.Add(this.theButton);//添加按钮到Form1
- this.Controls.Add(this.editor);//添加编辑器到Form1
- this.Name = "Form1";
- this.Text = "EasyScintilla Test App";
- //this.Load += new System.EventHandler(this.Form1_Load);
- this.Closing += new System.ComponentModel.CancelEventHandler(this.Form1_Closing);//添加关闭事件
- this.ResumeLayout(false);
- }
- #endregion
- }
-
- //========================================
- //========================================
- public class Nakano{
-
- //语言样式字段
- private static Hashtable _theStyler=new Hashtable();
- private static int _initiga=0;
- private static void theInit(){
- _theStyler.Add("C#", new CSharpStyler());
- _theStyler.Add("C# (Dark)", new DarkCSharpStyler());
- _theStyler.Add("Windows Batch" ,new BatchStyler());
- _theStyler.Add("HTML", new HtmlStyler());
- _theStyler.Add("JSON", new JsonStyler());
- _theStyler.Add("PowerShell", new PowerShellStyler());
- _theStyler.Add("Python", new PythonStyler());
- _theStyler.Add("Ruby", new RubyStyler());
- _theStyler.Add("T-SQL", new SqlStyler());
- _theStyler.Add("Teradata Parallel Transporter", new TptStyler());
- }
- //语言样式属性
- public static Hashtable TheStyler{
- get {
- if(_initiga==0){theInit();_initiga=1;return _theStyler;}
- return _theStyler;}}
-
- public static string EasySci (string code, string codeType)
- {
- if(_initiga==0){_initiga=1;theInit();}
- var theForm1=new Form1();
- StringBuilder theStr;
- if(_theStyler.ContainsKey(codeType))
- {
- theForm1.editor.Styler=(ScintillaStyler)_theStyler[codeType];
- }
-
- theForm1.editor.Text=code;
-
- theForm1.ShowDialog();
-
- theStr=new StringBuilder(theForm1.thertStr);
-
- theForm1.Dispose();
-
- return theStr.ToString();
- }
- }
- //========================================
- //========================================
- }
复制代码
|