private void LoadPreset(string opt) { try { _byHand = true; string[] opts = opt.Split('|'); cbMode.SelectedValue = opts[0]; _shColor = DApp.CreateColor(opts[1]); applyColorForUI(); tbOpacity.Text = opts[2]; tbAngle.Text = opts[3]; tbDistance.Text = opts[4]; tbSize.Text = opts[5]; tbFeather.Text = opts[6]; tbDPI.Text = opts[7]; cbDPI.IsChecked = ValToBool(opts[8]); cbGroup.IsChecked = ValToBool(opts[9]); cbOverPrint.IsChecked = ValToBool(opts[10]); cbBitmapToPowerClip.IsChecked = ValToBool(opts[11]); cbInnerShadow.IsChecked = false; if (opts.Length == 13) { cbInnerShadow.IsChecked = ValToBool(opts[12]); } _byHand = false; } catch (Exception err) { MessageBox.Show(err.ToString(), MName, MessageBoxButton.OK, MessageBoxImage.Error); _byHand = false; } }
private void applyColorForUI() { Corel.Interop.VGCore.Color nRGB = DApp.CreateRGBColor(0, 0, 0); nRGB.CopyAssign(_shColor); if (nRGB.Type != cdrColorType.cdrColorRGB) { nRGB.ConvertToRGB(); } ShadowColor.Background = new SolidColorBrush(Color.FromRgb((byte)nRGB.RGBRed, (byte)nRGB.RGBGreen, (byte)nRGB.RGBBlue)); ShadowColor.ToolTip = _shColor.Name + "\n" + _shColor.get_Name(true); (this.FindName("toRGB") as MenuItem).IsEnabled = true; (this.FindName("toCMYK") as MenuItem).IsEnabled = true; (this.FindName("toGRAY") as MenuItem).IsEnabled = true; switch (_shColor.Type.ToString()) { case "cdrColorRGB": (this.FindName("toRGB") as MenuItem).IsEnabled = false; break; case "cdrColorCMYK": (this.FindName("toCMYK") as MenuItem).IsEnabled = false; break; case "cdrColorGray": (this.FindName("toGRAY") as MenuItem).IsEnabled = false; break; } }
private void LoadSettings() { var xDoc = new XmlDocument(); xDoc.Load(_uPath); _byHand = true; foreach (XmlNode n in xDoc.SelectSingleNode(@"/App/Options").ChildNodes) { switch (n.Name) { case "BlendMode": cbMode.SelectedValue = n.InnerText; break; case "Color": _shColor = DApp.CreateColor(n.InnerText); break; case "Opacity": tbOpacity.Text = n.InnerText; break; case "Angle": tbAngle.Text = n.InnerText; break; case "Distance": tbDistance.Text = n.InnerText; break; case "Size": tbSize.Text = n.InnerText; break; case "Feather": tbFeather.Text = n.InnerText; break; case "DPI": tbDPI.Text = n.InnerText; break; case "UseDocumentDPI": cbDPI.IsChecked = ValToBool(n.InnerText); break; case "GroupShadowWithParent": cbGroup.IsChecked = ValToBool(n.InnerText); break; case "ShadowOverPrint": cbOverPrint.IsChecked = ValToBool(n.InnerText); break; case "BitmapToPowerClip": cbBitmapToPowerClip.IsChecked = ValToBool(n.InnerText); break; case "InnerShadow": cbInnerShadow.IsChecked = ValToBool(n.InnerText); break; case "exOptions": exOptions.IsExpanded = ValToBool(n.InnerText); break; case "exPresets": exPresets.IsExpanded = ValToBool(n.InnerText); break; case "exHelp": exHelp.IsExpanded = ValToBool(n.InnerText); break; } } _byHand = false; }
private void DecodeOldColor(string col) { try { int cm = Int32.Parse(col.Substring(0, 4), NumberStyles.HexNumber); int c1 = Int32.Parse(col.Substring(4, 4), NumberStyles.HexNumber); int c2 = Int32.Parse(col.Substring(8, 4), NumberStyles.HexNumber); int c3 = Int32.Parse(col.Substring(12, 4), NumberStyles.HexNumber); int c4 = Int32.Parse(col.Substring(16, 4), NumberStyles.HexNumber); int c5 = Int32.Parse(col.Substring(20, 4), NumberStyles.HexNumber); int c6 = Int32.Parse(col.Substring(24, 4), NumberStyles.HexNumber); int c7 = Int32.Parse(col.Substring(28, 4), NumberStyles.HexNumber); _shColor = DApp.CreateColorEx(cm, c1, c2, c3, c4, c5, c6, c7); } catch (Exception err) { MessageBox.Show(err.ToString(), MName, MessageBoxButton.OK, MessageBoxImage.Error); } }