public ControlUI(object app) { InitializeComponent(); try { this.corelApp = app as corel.Application; this.corelApp.OnApplicationEvent += CorelApp_OnApplicationEvent; LoadThemeFromPreference(); } catch (Exception) { global::System.Windows.MessageBox.Show("VGCore Erro"); } string filePath = ""; //#if Debug // filePath = "C:\\Users\\bonus\\AppData\\Roaming\\Corel\\CorelDRAW Graphics Suite X8\\Draw\\Workspace\\_default.cdws"; // CallXMLForm(filePath); // return; //#endif btn_Command.Click += (s, e) => { OpenFileDialog of = new OpenFileDialog(); of.Filter = "DrawUI|*.xml|Workspace file|*.cdws"; if (!(bool)of.ShowDialog()) { return; } filePath = of.FileName; CallXMLForm(filePath); }; }
private void ReadText(corel.Application app) { try { corel.Documents docs = app.Documents; foreach (corel.Document d in docs) { txtBox_Info.Text += d.Name + "\r\n"; corel.Pages pgs = d.Pages; foreach (corel.Page p in pgs) { txtBox_Info.Text += p.Name + "\r\n"; corel.Layers lyrs = p.Layers; foreach (corel.Layer l in lyrs) { Corel.Interop.VGCore.ShapeRange sr = l.Shapes.FindShapes(); txtBox_Info.Text += l.Name + " *** Number of objects : " + sr.Count + "\r\n"; for (int i = 1; i <= sr.Count; i++) { if (sr[i] != null && sr[i].Type == corel.cdrShapeType.cdrTextShape) { txtBox_Info.Text += sr[i].Text.Story.Text + "\r\n"; } } } txtBox_Info.Text += "*****-----*****\r\n"; } } } catch (Exception ex) { txtBox_Info.Text = ex.Message; } }
public Ui(object app) { try { InitializeComponent(); dApp = (Corel.Interop.VGCore.Application)app; var uFolderPath = Environment.GetEnvironmentVariable("APPDATA") + @"\Corel\" + mName; if (!Directory.Exists(uFolderPath)) Directory.CreateDirectory(uFolderPath); sPath = uFolderPath + @"\Presets.xml"; if (!File.Exists(sPath)) { var xDoc = new XmlDocument(); var dec = xDoc.CreateXmlDeclaration("1.0", "UTF-8", null); xDoc.AppendChild(dec); var root = xDoc.CreateElement("Presets"); root.SetAttribute("increase", "1"); xDoc.AppendChild(root); xDoc.Save(sPath); } LoadPresets(); } catch (Exception err) { MessageBox.Show(err.ToString(), mName, MessageBoxButton.OK, MessageBoxImage.Error); } }
public Ui(object app) { try { InitializeComponent(); dApp = (Corel.Interop.VGCore.Application)app; var uFolderPath = Environment.GetEnvironmentVariable("APPDATA") + @"\Corel\" + mName; if (!Directory.Exists(uFolderPath)) { Directory.CreateDirectory(uFolderPath); } sPath = uFolderPath + @"\Presets.xml"; if (!File.Exists(sPath)) { var xDoc = new XmlDocument(); var dec = xDoc.CreateXmlDeclaration("1.0", "UTF-8", null); xDoc.AppendChild(dec); var root = xDoc.CreateElement("Presets"); root.SetAttribute("increase", "1"); xDoc.AppendChild(root); xDoc.Save(sPath); } LoadPresets(); } catch (Exception err) { MessageBox.Show(err.ToString(), mName, MessageBoxButton.OK, MessageBoxImage.Error); } }
private void LoadData(corel.Application app) { SqlConnection sqlConn = null; try { // Connecting the SQL Server sqlConn = new SqlConnection("Data Source=(local)\\sqlexpress;Initial Catalog=Sample;Integrated Security=True"); // Calling the Stored Procedure SqlCommand cmd = new SqlCommand("ItemInfo", sqlConn); cmd.CommandType = CommandType.Text; cmd.CommandText = "SELECT [ItemId], [ItemName], [ItemDesc] FROM [Sample].[dbo].[ItemInfo]"; SqlDataAdapter da = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); sqlConn.Open(); da.Fill(ds); if (ds.Tables[0].Rows.Count > 0) { // Binding the Grid with the Itemsource property itemGrid.ItemsSource = ds.Tables[0].DefaultView; } } catch (Exception ex) { txtBox_Info.Text = ex.Message; } finally { if (sqlConn != null && sqlConn.State == ConnectionState.Open) { sqlConn.Close(); } } }
public frmToJPG(Corel.Interop.VGCore.Application app) : base(app) { InitializeComponent(); this.cmdName = "导出图片"; CheckForIllegalCrossThreadCalls = false; }
public Docker(object app) { try { InitializeComponent(); DApp = (Corel.Interop.VGCore.Application)app; Load1(); cbMode.Items.Add("Normal"); cbMode.Items.Add("Multiply"); cbMode.Items.Add("Add"); MouseUp += new MouseButtonEventHandler(MainWindow_MouseUp); MouseMove += new MouseEventHandler(MainWindow_MouseMove); //if (!File.Exists(uPath)) CreateXml(); LoadSettings(); LoadLangMenu(); applyColorForUI(); LoadPresets(); /* load help */ _xHelp = new XmlDocument(); _xHelp.Load(ULangPath); /* load help */ } catch (Exception err) { MessageBox.Show(err.ToString(), MName, MessageBoxButton.OK, MessageBoxImage.Error); } }
public DockerUI(corel.Application app) { this.corelApp = app; InitializeComponent(); boost = new Boost(app); //default colorRemapUserColor.CMYKAssign(0, 0, 0, 0); colorToUserColor.CMYKAssign(0, 0, 0, 100); UpdateColorBar(); cbRemap.SelectedIndex = 0; cbRemapColorType.SelectedIndex = 0; cbRemapColorSpaceType.SelectedIndex = 0; cbRemapColorRangeType.SelectedIndex = 0; cbTo.SelectedIndex = 0; cbToColorSpaceType.SelectedIndex = 0; cbApplyRange.SelectedIndex = 0; chbApplyFill.IsChecked = true; chbApplyOutline.IsChecked = true; for (int i = 0; i < fountainColorTint.Count(); i++) { fountainColorTint[i] = corelApp.CreateCMYKColor(0, 0, 0, i); } pantonePalettes = new XmlPaletteService(corelApp).LoadPalettes(); lbPantonePalette.ItemsSource = pantonePalettes; lbPantonePalette.SelectAll(); }
public XmlPaletteService(corel.Application corelApp) { this.corelApp = corelApp; palettePantonePlusPath = corelApp.SetupPath + @"Color\Palettes\Spot\PANTONE\PANTONE+\"; palettePreviousPath = corelApp.SetupPath + @"Color\Palettes\Spot\PANTONE\Previous Version\"; }
public ControlUI(object app) { InitializeComponent(); try { corelApp = app as corel.Application; stylesController = new Styles.StylesController(this.Resources, corelApp); DataSourceFactory dataSourceFactory = new DataSourceFactory(); dataSourceFactory.AddDataSource("FacaDS", typeof(FacaDataSource)); dataSourceFactory.Register(); } catch { global::System.Windows.MessageBox.Show("VGCore Erro"); } btn_Command.Click += (s, e) => { try { DataSourceProxy dsp2 = corelApp.FrameWork.Application.DataContext.GetDataSource("FacaDS"); dsp2.InvokeMethod("OnDraw"); } catch (Exception err) { Debug.WriteLine(err.Message); } }; }
public Form1(corel.Application app) { this.corelApp = app; InitializeComponent(); datas = new ArrayList(); templates = new ArrayList(); testList = new ArrayList(); }
public void DrawArrow(Corel.Interop.VGCore.Application app) { //Criando um segmento de linha com ponta de flecha Corel.Interop.VGCore.Shape line = app.ActiveDocument.ActiveLayer.CreateLineSegment(0, 0, 1.5, 0); line.Outline.EndArrow = app.ArrowHeads[2]; //Inicio de flecha // line.Outline.StartArrow = app.ArrowHeads[2]; }
public DockerUI(corel.Application app) { this.corelApp = app; InitializeComponent(); replaceColor.CMYKAssign(0, 0, 0, 0); applyColor.CMYKAssign(0, 0, 0, 100); updateColorSampleBar(); }
public BasicDraw(Corel.Interop.VGCore.Application app) { InitializeComponent(); btn_drawCicle.Click += (s, e) => { app.ActiveDocument.ActiveLayer.CreateEllipse(0, 0, 1.5, 1.5); }; btn_drawSquad.Click += (s, e) => { app.ActiveDocument.ActiveLayer.CreateRectangle(0, 0, 1.5, 1.5); }; btn_drawLine.Click += (s, e) => { app.ActiveDocument.ActiveLayer.CreateLineSegment(0, 0, 1.5, 0); }; btn_drawText.Click += (s, e) => { app.ActiveDocument.ActiveLayer.CreateArtisticText(0, 0, "Hello, this is a test"); }; btn_drawArrow.Click += (s, e) => { DrawArrow(app); }; btn_curveArea.Click += (s, e) => { CurveArea(app); }; }
public DockerUI(corel.Application app) { this.corelApp = app; InitializeComponent(); btn_drawCicle.Click += (s, e) => { app.ActiveDocument.ActiveLayer.CreateEllipse(0, 0, 2, 2); }; btn_drawSquad.Click += (s, e) => { app.ActiveDocument.ActiveLayer.CreateRectangle(0, 0, 3, 2); }; btn_changeColor.Click += (s, e) => { ChangeColor(app); }; btn_ReadText.Click += (s, e) => { ReadText(app); }; btn_LoadData.Click += (s, e) => { LoadData(app); }; btn_linkText.Click += (s, e) => { LinkText(app); }; }
/// <summary> /// Desables optimization features, close the command group and reflesh UI /// </summary> /// <param name="app"></param> public static void EndDraw(this Corel.Interop.VGCore.Application app) { if (app.ActiveDocument != null) { app.ActiveDocument.EndCommandGroup(); app.ActiveDocument.PreserveSelection = false; } app.Optimization = false; app.EventsEnabled = true; app.Refresh(); }
public ConvertColorSpacePantone(corel.Application app, List <string> palettesID) { corelApp = app; //palettesID = new string[] { // "6e75244b-d853-4d2e-bea2-a5da3f195d08", //PANTONE+ Solid Coated-V2 // "978463a2-0b90-4f87-8d5b-7220fbd06768", //PANTONE+ Pastels & Neons Coated // "66570bd8-9070-44a3-91cd-a695987fc88b", //PANTONE+ Premium Metallics Coated // "3ab7ce0c-8952-4838-8ebb-8fdfcf3d2c2a" }; //PANTONE® metallic coated this.palettesID = palettesID; foundColors = new Dictionary <string, Color>(); }
public DockerUI(corel.Application app) { this.corelApp = app; m_current = this; InitializeComponent(); AddinUtilities.initFonts(); AddinUtilities.copyLatexTemplate("LatexTemplate.txt", Properties.Resources.LatexTemplate); m_dialog = new LatexDialog(); SettingsManager mgr = SettingsManager.getCurrent(); }
///<summary> /// Constructor for the Addon. This is called by CorelDRAW or Corel DESIGNER when it is discovered. ///</summary> public Addon(Corel.Interop.VGCore.Application application) { this.application = application; application.OnPluginCommand += application_OnPluginCommand; application.OnUpdatePluginCommand += application_OnUpdatePluginCommand; application.OnApplicationEvent += application_OnApplicationEvent; application.Start += application_Start; application.DocumentOpen += application_DocumentOpen; application.DocumentBeforeSave += application_DocumentBeforeSave; // Create and register our tool //ToolState toolState = new CGS.cdrPluginT(Application); //Application.RegisterToolState("c7722bb4-c835-4aec-b257-17d3370badae", "cdrPluginT", toolState); bool exists = false; foreach (CommandBar cmb in application.FrameWork.CommandBars) { if (cmb.Name.Equals(BarName)) { //cmb.Delete(); exists = true; break; } } application.AddPluginCommand(CommandID, "全能插件", "全能插件"); application.AddPluginCommand(CommandID_TOJPG, "导出图片", "导出图片"); application.AddPluginCommand(CommandID_COLORCHANGE, "颜色替换", "颜色替换"); application.AddPluginCommand(CommandID_COMPRESSTEXT, "压缩标点", "压缩标点"); application.AddPluginCommand(CommandID_CONVERTTO, "文字转曲", "文字转曲"); application.AddPluginCommand(CommandID_PSTOCOREL, "一键PS", "一键PS"); application.AddPluginCommand(CommandID_CROPMARK, "裁切线", "裁切线"); if (!exists) { //CommandBar cb = application.FrameWork.CommandBars[BarName]; //cb.Protection = cuiBarProtection.cuiBarNoMove; /* * CommandBar cb = application.FrameWork.CommandBars.Add(BarName, cuiBarPosition.cuiBarFloating, false); * * * Corel.Interop.VGCore.Control c = cb.Controls.AddCustomButton("ab489730-8791-45d2-a825-b78bbe0d6a5d", CommandID); * * * Corel.Interop.VGCore.Control c1 = cb.Controls.AddCustomButton("ab489730-8791-45d2-a825-b78bbe0d6a5d", CommandID_TOJPG); * c1.SetIcon2(@"guid://c7722bb4-c835-4aec-b257-17d3370badae"); * * Corel.Interop.VGCore.Control c2 = cb.Controls.AddCustomButton("ab489730-8791-45d2-a825-b78bbe0d6a5d", CommandID_COLORCHANGE); * c2.SetIcon2(@"guid://5b1309be-b43e-4611-9492-b09308a77699"); * * Corel.Interop.VGCore.Control c3 = cb.Controls.AddCustomButton("ab489730-8791-45d2-a825-b78bbe0d6a5d", CommandID_COMPRESSTEXT); */ } }
public DockerUI(object app) { InitializeComponent(); try { this.corelApp = app as corel.Application; stylesController = new Styles.StylesController(this.Resources, this.corelApp); } catch { global::System.Windows.MessageBox.Show("VGCore Erro"); } }
public DockerUI(object app) { InitializeComponent(); try { this.corelApp = app as corel.Application; this.corelApp.OnApplicationEvent += CorelApp_OnApplicationEvent; } catch (Exception) { global::System.Windows.MessageBox.Show("VGCore Erro"); } }
public ControlUI(object app) { InitializeComponent(); try { this.corelApp = app as corel.Application; stylesController = new Styles.StylesController(this.Resources, this.corelApp); } catch { global::System.Windows.MessageBox.Show("VGCore Erro"); } btn_Command.Click += (s, e) => { corelApp.MsgShow("Working"); }; }
public ControlUI(object app) { try { corelApp = app as corel.Application; var dsf = new DataSource.DataSourceFactory(); dsf.AddDataSource("$safeprojectname$DS", typeof(DataSource.$safeprojectname$DataSource)); dsf.Register(); } catch { global::System.Windows.MessageBox.Show("VGCore Erro"); } }
public Docker(Corel.Interop.VGCore.Application app) { InitializeComponent(); this.app = app; BitmapResources br = new BitmapResources(); img_bonus.Source = br.Bonus630; img_corelNaVeia.Source = br.CorelNaVeia2015; app.DocumentNew += app_DocumentNew; app.DocumentOpen += app_DocumentOpen; app.WindowActivate += app_WindowActivate; this.Loaded += Docker_Loaded; }
public clsConfig(Application app) { clsFind = new Color(); clrReplace = new Color(); clsFind.CMYKAssign(0, 0, 0, 100); clrReplace.CMYKAssign(0, 0, 0, 100); PreserveTints = false; ReplaceFills = true; ReplaceOutlines = true; ReplaceInsideText = false; cols = 5; this.mApp = app; }
public ControlUI(object app) { InitializeComponent(); try { this.corelApp = app as corel.Application; this.corelApp.OnApplicationEvent += CorelApp_OnApplicationEvent; } catch (Exception) { global::System.Windows.MessageBox.Show("VGCore Erro"); } btn_Command.Click += (s, e) => { corelApp.MsgShow("Working"); }; }
public RFcontrol(object app) { try { InitializeComponent(); dApp = (Corel.Interop.VGCore.Application)app; Stream imgStream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("RecentFiles.no-thumb.png"); var nImg = new BitmapImage(); nImg.BeginInit(); nImg.StreamSource = imgStream; nImg.EndInit(); noThmb = nImg; Load1(); LoadLangMenu(); db = new DB(); fWin = new FlyWin(); var uriSource = new Uri("pack://application:,,,/RecentFiles;component/Images/save_off.png"); btnIcon.Source = new BitmapImage(uriSource); dApp.DocumentOpen += new Corel.Interop.VGCore.DIVGApplicationEvents_DocumentOpenEventHandler(dApp_DocumentOpen); dApp.DocumentAfterSave += new Corel.Interop.VGCore.DIVGApplicationEvents_DocumentAfterSaveEventHandler(dApp_DocumentAfterSave); dApp.DocumentBeforeSave += new Corel.Interop.VGCore.DIVGApplicationEvents_DocumentBeforeSaveEventHandler(dApp_DocumentBeforeSave); dApp.DocumentClose += new Corel.Interop.VGCore.DIVGApplicationEvents_DocumentCloseEventHandler(dApp_DocumentClose); backColor = new SolidColorBrush(Color.FromRgb(90, 90, 90)); ofiles = new List <OpenedFile>(); if (!File.Exists(uPath)) { var xDoc = new XmlDocument(); var dec = xDoc.CreateXmlDeclaration("1.0", "UTF-8", null); xDoc.AppendChild(dec); var root = xDoc.CreateElement("Documents"); xDoc.AppendChild(root); xDoc.Save(uPath); } db.LoadList(); } catch (Exception err) { MessageBox.Show(err.ToString(), mName, MessageBoxButton.OK, MessageBoxImage.Error); } }
/// <summary> /// Active optimization features, and start a command group /// </summary> /// <param name="app"></param> /// <param name="commandGroup"></param> /// <param name="optimization"></param> /// <param name="enableEvents"></param> /// <param name="preservSeletion"></param> public static void BeginDraw(this Corel.Interop.VGCore.Application app, bool commandGroup = true, bool optimization = true, bool enableEvents = false, bool preservSeletion = true) { if (app.ActiveDocument != null) { if (commandGroup) { app.ActiveDocument.BeginCommandGroup(); } if (preservSeletion) { app.ActiveDocument.PreserveSelection = preservSeletion; } } app.Optimization = optimization; app.EventsEnabled = enableEvents; }
protected override void OnLoad(EventArgs e) { try { app = new Corel.Interop.VGCore.Application(); } catch (Exception ex) { MessageBox.Show("请先开启Coreldraw X7(x64) " + ex.Message); this.Close(); } if (app.Documents.Count == 0) { MessageBox.Show("没有打开文档!", "错误"); this.Close(); } base.OnLoad(e); }
public ControlUI(object app) { InitializeComponent(); try { this.corelApp = app as corel.Application; stylesController = new Styles.StylesController(this.Resources, this.corelApp); } catch { global::System.Windows.MessageBox.Show("VGCore Erro"); } btn_Command.Click += (s, e) => { ColorPicker c = new ColorPicker(corelApp.ActivePalette); if ((bool)c.ShowDialog()) { corelApp.MsgShow(c.SelectedColor.CorelColorName); } }; }
public void ChangeColor(Corel.Interop.VGCore.Application app) { try { corel.Shapes sh = app.ActiveDocument.ActiveLayer.Shapes; Random random = new Random(); for (int i = 1; i <= sh.Count; i++) { corel.Shape s = sh[i]; if (s.Selected) { s.Fill.UniformColor.CMYAssign(random.Next(0, 255), random.Next(0, 255), random.Next(0, 255)); } } } catch (Exception ex) { txtBox_Info.Text = ex.Message; } }