假设我想为ocaml编程语言创建一个源代码编辑器,我该从哪里开始呢?我希望为Windows平台创建一个编辑器作为一个业余爱好项目。我的主要技能是web开发。我很久以前就开发了windows应用程序。我不知道它是如何用今天可用的工具完成的。我有visual Studio2008,C#是我选择的语言。
发布于 2010-05-05 08:57:13
您需要知道:
>H111如何打开和保存文件
您可能希望查看一些开源编辑器,如dev-c++或gedit
此外,由于您本人更加热衷于网络开发,因此您可能想要开始创建一个可以在web浏览器中运行的应用程序。这通常会更容易,并帮助您理解创建代码编辑器的基础知识。之后,您可以随时为桌面编写一个。
发布于 2010-05-05 08:49:32
如果您最习惯使用Visual Studio,那么您可以使用Visual Studio Shell在此基础上创建自己的IDE。
这里有一个播客,给出了一个很好的概述:http://www.code-magazine.com/codecast/index.aspx?messageid=32b9401a-140d-4acb-95bb-6accd3a3dafc
此外,作为参考,使用Visual Studio2008Shell创建了IronPython Studio:http://ironpythonstudio.codeplex.com/
浏览源代码应该会给你一个很好的起点。
发布于 2010-05-05 09:10:15
一种更轻量级的替代方法是使用RichEdit control
示例:
http://www.codeproject.com/Messages/3401956/NET-Richedit-Control.aspx
// http://www.codeproject.com/Messages/3401956/NET-Richedit-Control.aspx
using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace RichEditor
{
public class RichTextBoxEx : RichTextBox
{
IntPtr mHandle = IntPtr.Zero;
protected override CreateParams CreateParams
{
get
{
// Prevent module being loaded multiple times.
if (this.mHandle == IntPtr.Zero)
{
// load the library to obtain an instance of the RichEdit50 class.
this.mHandle = LoadLibrary("msftedit.dll");
}
// If module loaded, reset ClassName.
if (this.mHandle != IntPtr.Zero)
{
CreateParams cParams = base.CreateParams;
// Check Unicode or ANSI system and set appropriate ClassName.
if (Marshal.SystemDefaultCharSize == 1)
{
cParams.ClassName = "RichEdit50A";
}
else
{
cParams.ClassName = "RichEdit50W";
}
return cParams;
}
else // Module wasnt loaded, return default .NET RichEdit20 CreateParams.
{
return base.CreateParams;
}
}
}
~RichTextBoxEx()
{
//Free loaded Library.
if (mHandle != IntPtr.Zero)
{
FreeLibrary(mHandle);
}
}
[DllImport("kernel32.dll", SetLastError = true)]
private static extern IntPtr LoadLibrary(String lpFileName);
[DllImport("kernel32.dll", SetLastError = true)]
private static extern bool FreeLibrary(IntPtr hModule);
}
}https://stackoverflow.com/questions/2769846
复制相似问题