public AppearancePage() : base(PropertyPageFactory.AppearanceGroupGuid) { InitializeComponent(); if (GitterApplication.TextRenderer == GitterApplication.GdiPlusTextRenderer) { _radGdiPlus.Checked = true; } else if (GitterApplication.TextRenderer == GitterApplication.GdiTextRenderer) { _radGdi.Checked = true; } _selectedStyle = GitterApplication.StyleOnNextStartup; int yOffset = 3; foreach (var style in GitterApplication.Styles) { var themeRadioButton = new RadioButton() { Left = 3, Top = yOffset, Width = _pnlThemesContainer.ClientSize.Width - SystemInformation.VerticalScrollBarWidth - 2, Text = style.DisplayName, FlatStyle = FlatStyle.System, Tag = style, Checked = style == SelectedStyle, }; themeRadioButton.CheckedChanged += OnThemeRadioButtonCheckedChanged; _pnlThemesContainer.Controls.Add(themeRadioButton); yOffset += themeRadioButton.Height; } _pnlRestartRequiredWarning.Visible = SelectedStyle != GitterApplication.Style; }
private static void SelectStyle() { var styleName = _configurationService.GuiSection.GetValue <string>("Style", string.Empty); var style = Styles.FirstOrDefault(s => s.Name == styleName); if (style == null) { style = Styles.First(); } _styleOnNextStartup = style; Style = style; }
/// <summary>Create <see cref="ScrollableControl"/>.</summary> public ScrollableControl() { _borderStyle = BorderStyle.Fixed3D; if(LicenseManager.UsageMode == LicenseUsageMode.Designtime) { _style = new MSVS2010Style(); } SetStyle( ControlStyles.ContainerControl | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor, false); SetStyle( ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.Selectable | ControlStyles.OptimizedDoubleBuffer, true); CreateScrollBars(); BackColor = SystemColors.Window; }
/// <summary>Create <see cref="ScrollableControl"/>.</summary> public ScrollableControl() { _borderStyle = BorderStyle.Fixed3D; if (LicenseManager.UsageMode == LicenseUsageMode.Designtime) { _style = new MSVS2010Style(); } SetStyle( ControlStyles.ContainerControl | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor, false); SetStyle( ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.Selectable | ControlStyles.OptimizedDoubleBuffer, true); CreateScrollBars(); BackColor = SystemColors.Window; }
public void Render(IGitterStyle style, Graphics graphics, Font font, Rectangle rect) { bool useCache = _cachedRect == rect; if (useCache) { for (int i = 0; i < _glyphs.Length; ++i) { graphics.ExcludeClip(_glyphs[i].Region); } } else { var cr = graphics.MeasureCharacterRanges(_text, font, rect, _sf); for (int i = 0; i < _glyphs.Length; ++i) { _glyphs[i].Region = cr[i]; graphics.ExcludeClip(cr[i]); } } using (var brush = new SolidBrush(style.Colors.WindowText)) { GitterApplication.TextRenderer.DrawText( graphics, _text, font, brush, rect, _sf); } graphics.ResetClip(); bool clipIsSet = false; foreach (var glyph in _glyphs) { if (glyph != _hoveredLink.Item) { if (clipIsSet) { graphics.SetClip(glyph.Region, CombineMode.Union); } else { graphics.Clip = glyph.Region; clipIsSet = true; } } } if (clipIsSet) { using (var linkTextBrush = new SolidBrush(style.Colors.HyperlinkText)) { GitterApplication.TextRenderer.DrawText( graphics, _text, font, linkTextBrush, rect, _sf); } } if (_hoveredLink.IsTracked) { graphics.Clip = _hoveredLink.Item.Region; using (var f = new Font(font, FontStyle.Underline)) using (var linkTextBrush = new SolidBrush(style.Colors.HyperlinkTextHotTrack)) { GitterApplication.TextRenderer.DrawText( graphics, _text, f, linkTextBrush, rect, _sf); } } graphics.ResetClip(); _cachedRect = rect; }
public void Render(IGitterStyle style, Graphics graphics, Font font, Rectangle rect) { bool useCache = _cachedRect == rect; if(useCache) { for(int i = 0; i < _glyphs.Length; ++i) { graphics.ExcludeClip(_glyphs[i].Region); } } else { var cr = graphics.MeasureCharacterRanges(_text, font, rect, _sf); for(int i = 0; i < _glyphs.Length; ++i) { _glyphs[i].Region = cr[i]; graphics.ExcludeClip(cr[i]); } } using(var brush = new SolidBrush(style.Colors.WindowText)) { GitterApplication.TextRenderer.DrawText( graphics, _text, font, brush, rect, _sf); } graphics.ResetClip(); bool clipIsSet = false; foreach(var glyph in _glyphs) { if(glyph != _hoveredLink.Item) { if(clipIsSet) { graphics.SetClip(glyph.Region, CombineMode.Union); } else { graphics.Clip = glyph.Region; clipIsSet = true; } } } if(clipIsSet) { using(var linkTextBrush = new SolidBrush(style.Colors.HyperlinkText)) { GitterApplication.TextRenderer.DrawText( graphics, _text, font, linkTextBrush, rect, _sf); } } if(_hoveredLink.IsTracked) { graphics.Clip = _hoveredLink.Item.Region; using(var f = new Font(font, FontStyle.Underline)) using(var linkTextBrush = new SolidBrush(style.Colors.HyperlinkTextHotTrack)) { GitterApplication.TextRenderer.DrawText( graphics, _text, f, linkTextBrush, rect, _sf); } } graphics.ResetClip(); _cachedRect = rect; }