private void button1_Click(object sender, EventArgs e)
        {
            if (application.ActiveDocument.Selection().Shapes.Count == 0)
            {
                MessageBox.Show("请选择一个对象");
                return;
            }
            if (application.ActiveDocument.Selection().Shapes.Count > 1)
            {
                MessageBox.Show("只能选择一个对象");
                return;
            }
            if (application.ActiveShape.Type != cdrShapeType.cdrBitmapShape)
            {
                MessageBox.Show("请选择一个位图");
                return;
            }

            String PSPath = Settings.Default.PSPath;

            if (PSPath == "")
            {
                PSPath = getRegPSPath();
            }
            if (PSPath == "")
            {
                MessageBox.Show("未找到PS主程序photoshop.exe,请手动设置");
                frmSetPSPath f = new frmSetPSPath();
                f.Show(this);
                return;
            }

            StartEvent(true);
            BitmapA = application.ActiveSelectionRange;
            application.ActiveShape.GetMatrix(out d11, out d12, out d21, out d22, out tx, out ty);
            application.ActiveShape.ClearTransformations();

            Bitmap b = application.ActiveShape.Bitmap;

            CPtemp = application.CorelScriptTools().GetTempFolder() + "tisn2015.psd";
            try
            {
                ExportFilter expflt = application.ActiveDocument.ExportBitmap(CPtemp, cdrFilter.cdrPSD, cdrExportRange.cdrSelection, b.Mode, b.SizeWidth, b.SizeHeight, b.ResolutionX, b.ResolutionY, b.Mode == cdrImageType.cdr16ColorsImage ? cdrAntiAliasingType.cdrNoAntiAliasing : cdrAntiAliasingType.cdrNormalAntiAliasing, false, b.Mode == cdrImageType.cdr16ColorsImage ? false : true, true, false, cdrCompressionType.cdrCompressionNone);
                expflt.Finish();
            }
            catch (Exception ex)
            {
                MessageBox.Show("图片不在页面范围,请放入页面范围后重试!") ;
            }
            application.ActiveShape.SetMatrix(d11, d12, d21, d22, tx, ty);

            dtB = File.GetLastWriteTime(CPtemp);
            Process.Start(PSPath, CPtemp);
            if (MessageBox.Show("编辑完成单击确认,放弃编辑单击取消", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == System.Windows.Forms.DialogResult.OK)
            {
                dtA = File.GetLastWriteTime(CPtemp);
                if (dtA > dtB)
                {
                    EditEnd();
                }
            }
            EndEvent();
            SetForegroundWindow(new IntPtr(application.AppWindow.Handle));
            //application.AppWindow.WindowState = cdrWindowState.cdrWindowRestore;
            //timer1.Start();
        }
        private void button2_Click(object sender, EventArgs e)
        {
            frmSetPSPath f = new frmSetPSPath();

            f.Show(this);
        }