c#开发CDR第一弹
用c#开发环境编写CDR教程不废话直接上图上码,步兵有真相!!该代码运行功能是教你在X14中如何置入CDR文件的DEMO
我这是VS2008工具编写,在编译前请引用两个COM组件然后点编译
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace coreldrawTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button4_Click(object sender, EventArgs e)
{
try
{
CorelDRAW.Application cdr = new CorelDRAW.Application();
cdr.Visible = true;
cdr.CreateDocument();//创建文档
cdr.ActiveDocument.ActiveLayer.Import(@"C:\C.cdr", CorelDRAW.cdrFilter.cdrCDR, cdr.CreateStructImportOptions());//置入文件
cdr.Refresh();//刷新窗体
}
catch (Exception error)
{
MessageBox.Show(error.Message.ToString());
}
}
}
}
代码编译生产 几个文件运行coreldrawtest.exe
出现窗体后点置入文件按钮
置入成功!!
源码DEMO收点辛苦费
页:
[1]