diff options
author | Alexander Köplinger <alex.koeplinger@outlook.com> | 2016-10-19 21:46:43 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-19 21:46:43 +0300 |
commit | e292a2e4c78351eb101fe9fc927df62a005ede87 (patch) | |
tree | 7763b59739727a46fe73efc1d2b88f6af5ae8661 | |
parent | 78a492495a387c804f41e8ca619e2239138163b9 (diff) | |
parent | 7e040727a6009cf1e580dc8780559a1c949eec54 (diff) |
Merge pull request #46 from NattyNarwhal/fallback-search-rendering
WinDoc: Use fallback rendering if visual styles is disabled
-rw-r--r-- | windoc/WinDoc/CustomDrawing.cs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/windoc/WinDoc/CustomDrawing.cs b/windoc/WinDoc/CustomDrawing.cs index ec75d385..54b26686 100644 --- a/windoc/WinDoc/CustomDrawing.cs +++ b/windoc/WinDoc/CustomDrawing.cs @@ -54,7 +54,15 @@ namespace WinDoc // We use a TabRenderer to get the nice system gradient e.Graphics.Clear (Color.White); clip = new Rectangle (1, e.Bounds.Y + 1, e.Node.TreeView.ClientRectangle.Width - 3, e.Bounds.Height - 3); - TabRenderer.DrawTabItem (e.Graphics, clip, e.Node.Text, nodeFont, System.Windows.Forms.VisualStyles.TabItemState.Normal); + // If we're using the classic theme, then we can't use TabRender. Fall back to a simpler view. + if (TabRenderer.IsSupported) { + TabRenderer.DrawTabItem(e.Graphics, clip, e.Node.Text, nodeFont, System.Windows.Forms.VisualStyles.TabItemState.Normal); + } else { + e.Graphics.FillRectangle(SystemBrushes.ActiveCaption, clip); + // The fallback rendering has more empty space than the tab rendering. Take advantage of it. + var fallbackNodeFont = new Font(nodeFont.FontFamily, nodeFont.Size + 2); + e.Graphics.DrawString(e.Node.Text, fallbackNodeFont, SystemBrushes.ActiveCaptionText, clip.X, clip.Y); + } using (var pen = new Pen (Color.Black, 1.0f)) e.Graphics.DrawLine (pen, new Point (clip.Left, clip.Bottom), new Point (clip.Right - 1, clip.Bottom)); } else { |