我现在要浏览一张CAD的图,但是我的机子上有两个不同版本的CAD软件,我要指定其中的一个软件来查看该图。
因此首先要打开该软件,也就是先打开运行环境,然后再此环境中打开该文件
请问该如何去做?我用的是C#语言。因为第一次来,没有什么分,望高手帮帮忙!

解决方案 »

  1.   

    获取软件的路径,把CAD图的路径当作命令行参数,行不行呢
    如果直接打开CAD图,会以默认的程序打开
      

  2.   

                if (i == 1)
                    System.Diagnostics.Process.Start(@"Notepad.exe", "e:\\a.txt");
                else
                    System.Diagnostics.Process.Start(@"C:\Program Files\Microsoft Office\Office12\WINWORD.EXE", "e:\\a.txt");
      

  3.   

    用process.start()在c#中启动你需要的应用程序,然后再在应用程序打开文件
      

  4.   

     System.Diagnostics.Process.Start(@"C:\Program Files\Microsoft Office\Office12\WINWORD.EXE", "e:\\a.txt");
    这样就ok了。
      

  5.   

    关键是我不能把文件的打开方式做死了,客户的机子上有两个不同版本的CAD软件,他需要打开相应的CAD环境来查看相应的图形文件,根据大家的提议,我做的程序如下,望高手指点: 
    string exefile = di + "\\" + filename;/////需要查看的文件(例如:C:\Documents and Settings\ww\Local Settings\Temp\Test\CAD.dwg) 
                this.openFileDialog1.InitialDirectory = "c:\\"; 
                this.openFileDialog1.ShowDialog(); 
                string exepath = ""; 
                if (this.openFileDialog1.FileName.Length > 0) 
                    exepath = this.openFileDialog1.FileName;//////选择的执行程序(例如:D:\Program Files\AutoCAD 2004\acad.exe) 
                Process myprocess = new Process(); 
                myprocess.StartInfo.Verb = "Open"; 
                myprocess.StartInfo.FileName = exepath.Trim(); 
                myprocess.StartInfo.CreateNoWindow = true; 
                myprocess.StartInfo.Arguments = exefile.Trim(); 
                myprocess.Start(); 
    执行完后,就提示找不到图形文件,其实文件是存在的