コード例 #1
0
        protected virtual void DrawHighlight(Graphics g, Rectangle r, Color?c = null)
        {
            bool fakeNative = SelectionRenderStyle == DynamicTreeViewRenderStyle.Native && c != null;

            if (SelectionRenderStyle == DynamicTreeViewRenderStyle.Native && c == null)
            {
                VisualStyleRenderer renderer = ExplorerViewStyle.ItemHover;
                renderer.DrawBackground(g, r);
            }

            if (c == null)
            {
                c = Color.FromArgb(100, FakeNativeTreeStyleRenderer.SelectionColor);
            }
            else
            {
                c = FakeNativeTreeStyleRenderer.AlphaBlend(100, c.Value);
            }

            if (SelectionRenderStyle == DynamicTreeViewRenderStyle.FakeNative || fakeNative)
            {
                FakeNativeTreeStyleRenderer.DrawSelection(g, r, c.Value);
            }
            else if (SelectionRenderStyle == DynamicTreeViewRenderStyle.Simple)
            {
                g.FillRectangle(new SolidBrush(FakeNativeTreeStyleRenderer.AlphaBlend(50, c.Value)), r);
                g.DrawRectangle(new Pen(c.Value, 1.0f), r);
            }
        }
コード例 #2
0
        protected virtual void DrawSelection(Graphics g, Rectangle r, Color?c = null)
        {
            bool fakeNative = SelectionRenderStyle == DynamicTreeViewRenderStyle.Native && c != null;

            if (SelectionRenderStyle == DynamicTreeViewRenderStyle.Native && c == null)
            {
                VisualStyleRenderer renderer = Focused ? ExplorerViewStyle.ItemSelect : ExplorerViewStyle.ItemSelectNoFocus;
                renderer.DrawBackground(g, r);
            }

            if (c == null)
            {
                c = Focused ? FakeNativeTreeStyleRenderer.SelectionColor : FakeNativeTreeStyleRenderer.NoFocusSelectionColor;
            }

            if (SelectionRenderStyle == DynamicTreeViewRenderStyle.FakeNative || fakeNative)
            {
                FakeNativeTreeStyleRenderer.DrawSelection(g, r, c.Value);
            }
            else if (SelectionRenderStyle == DynamicTreeViewRenderStyle.Simple)
            {
                g.FillRectangle(new SolidBrush(FakeNativeTreeStyleRenderer.AlphaBlend(50, c.Value)), r);
                g.DrawRectangle(new Pen(c.Value, 1.0f), r);
            }
        }