请问高手,我用C#写的一个文本编辑器,也做了一个安装包,也使我的程序可以打开自定义的文件,比如.sd后缀文件,
可是我发现我的编辑器不能像其他文本编辑器一样双击.sd文件就可以读取其中的内容,请问.net中用什么类可以干这种事,类似于获取系统底层的事件或指针

解决方案 »

  1.   

    写到注册表HKEY_CLASS_ROOT\.dc\Shell\Open
    Command="你的程序路径 %1"
      

  2.   


    不知道是不是这样:
    private void Form1_Load(object sender, EventArgs e)
            {
                #region//取得双击后的文件名,并读取
                string PathFileName = Environment.CommandLine;
                string[] para=PathFileName.Split('\"');
                if (para.Length > 3)
                {
                    ReadText(para[3]);
                }
                #endregion
            }        private void ReadText(string PathFileName)
            {
                StreamReader sr = new StreamReader(PathFileName, Encoding.Default);
                string readtxt = sr.ReadToEnd();
                richTextBox.Text = readtxt;
                sr.Close();
            }