static Style() { Directory.CreateDirectory(StylesDirectory); LoadStyles(); if (!LoadCurrentStyle()) { CurrentStyle = new Style(); SaveCurrentStyle(); } }
private static void AddToList(Style style, string stylePath) { if (!styles.ContainsKey(stylePath)) { styles.Add(stylePath, style); } else // Replace the old style { styles.Remove(stylePath); styles.Add(stylePath, style); } }
private void cboStyle_SelectedIndexChanged(object sender, EventArgs e) { Style style = cboStyle.SelectedItem as Style; if (style != null) { selectedStyle = style; printPreview.InvalidatePreview(); } }
private static bool LoadCurrentStyle() { return ((currentStyle = Load(userStylePath, false)) != null); }
private void printDocument_EndPrint(object sender, PrintEventArgs e) { if (printingStyle != null) { printingStyle.Dispose(); printingStyle = null; } }
private void printDocument_BeginPrint(object sender, PrintEventArgs e) { if (document != null && printDocument.PrinterSettings.IsValid) { pageIndex = 0; printingStyle = MakeShadowsOpaque(selectedStyle); printDocument.DocumentName = document.Name; } else { e.Cancel = true; } }
private static Style MakeShadowsOpaque(Style selectedStyle) { Style converted = selectedStyle.Clone(); converted.ShadowColor = DisableTransparency(converted.ShadowColor); return converted; }
private void LoadSettings() { // General settings cboLanguage.SelectedItem = UILanguage.CreateUILanguage(Settings.Default.UILanguage); chkRememberOpenProjects.Checked = Settings.Default.RememberOpenProjects; // Diagram settings chkUsePrecisionSnapping.Checked = DiagramEditor.Settings.Default.UsePrecisionSnapping; if (DiagramEditor.Settings.Default.ShowChevron == ChevronMode.Always) radChevronAlways.Checked = true; else if (DiagramEditor.Settings.Default.ShowChevron == ChevronMode.AsNeeded) radChevronAsNeeded.Checked = true; else radChevronNever.Checked = true; if (DiagramEditor.Settings.Default.UseClearType == ClearTypeMode.Always) radClearTypeAlways.Checked = true; else if (DiagramEditor.Settings.Default.UseClearType == ClearTypeMode.WhenZoomed) radClearTypeWhenZoomed.Checked = true; else radClearTypeNever.Checked = true; chkClearTypeForImages.Checked = DiagramEditor.Settings.Default.UseClearTypeForImages; // Style settings savedStyle = (Style) Style.CurrentStyle.Clone(); stylePropertyGrid.SelectedObject = Style.CurrentStyle; }
private void ChangeCurrentStyle(Style style) { Style.CurrentStyle = style; stylePropertyGrid.SelectedObject = Style.CurrentStyle; if (StyleModified != null) StyleModified(this, EventArgs.Empty); }