Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono-tools.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCalvin <calvin@openmailbox.org>2016-10-15 17:06:02 +0300
committerCalvin <calvin@openmailbox.org>2016-10-15 17:06:02 +0300
commit7e040727a6009cf1e580dc8780559a1c949eec54 (patch)
tree7763b59739727a46fe73efc1d2b88f6af5ae8661
parent78a492495a387c804f41e8ca619e2239138163b9 (diff)
Use fallback rendering if visual styles is disabled
TabRenderer requires visual styles to function. If disabled, we can use a simplistic fallback instead.
-rw-r--r--windoc/WinDoc/CustomDrawing.cs10
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 {