public override int RenderTextEx(IntPtr htheme,
                                         IntPtr hdc,
                                         int partid, int stateid,
                                         string psztext, int cchtext,
                                         NativeMethods.DT dwtextflags,
                                         IntPtr prect, ref NativeMethods.DTTOPTS poptions)
        {
            switch ((Parts)partid)
            {
            case Parts.LVP_GROUPHEADER:
            {
                NativeMethods.GetThemeColor(htheme, partid, stateid, poptions.iColorPropId,
                                            out var crefText);
                var color        = Color.FromArgb(crefText.R, crefText.G, crefText.B);
                var adaptedColor = color.AdaptTextColor();

                // do not render, just modify text color
                poptions.iColorPropId = 0;
                poptions.crText       = ColorTranslator.ToWin32(adaptedColor);

                // proceed to default implementation with modified poptions parameter
                return(Unhandled);
            }
            }

            return(Unhandled);
        }
        public override int RenderTextEx(IntPtr htheme, IntPtr hdc, int partid, int stateid,
                                         string psztext, int cchtext, NativeMethods.DT dwtextflags,
                                         IntPtr prect, ref NativeMethods.DTTOPTS poptions)
        {
            Color textColor;

            switch ((Parts)partid)
            {
            case Parts.CP_READONLY:
                switch ((State.Readonly)stateid)
                {
                case State.Readonly.CBRO_NORMAL:
                case State.Readonly.CBRO_HOT:
                case State.Readonly.CBRO_PRESSED:
                    textColor = SystemColors.ControlText;
                    break;

                case State.Readonly.CBRO_DISABLED:
                    textColor = SystemColors.ControlDark;
                    break;

                default:
                    return(Unhandled);
                }

                // do not render, just modify text color
                poptions.dwFlags     |= NativeMethods.DTT.TextColor;
                poptions.iColorPropId = 0;
                poptions.crText       = ColorTranslator.ToWin32(textColor);
                return(Unhandled);

            default:
                return(Unhandled);
            }
        }
 public virtual int RenderTextEx(IntPtr htheme,
                                 IntPtr hdc,
                                 int partid, int stateid,
                                 string psztext, int cchtext,
                                 NativeMethods.DT dwtextflags,
                                 IntPtr prect, ref NativeMethods.DTTOPTS poptions)
 {
     return(Unhandled);
 }
        public override int RenderTextEx(IntPtr htheme, IntPtr hdc, int partid, int stateid,
                                         string psztext, int cchtext,
                                         NativeMethods.DT dwtextflags, IntPtr prect,
                                         ref NativeMethods.DTTOPTS poptions)
        {
            switch ((Parts)partid)
            {
            case Parts.TVP_TREEITEM:
            {
                if (poptions.dwFlags.HasFlag(NativeMethods.DTT.TextColor))
                {
                    return(Unhandled);
                }

                Color foreColor;
                switch ((State.Item)stateid)
                {
                case State.Item.TREIS_DISABLED:
                    foreColor = SystemColors.GrayText;
                    break;

                case State.Item.TREIS_SELECTED:
                case State.Item.TREIS_HOTSELECTED:
                case State.Item.TREIS_SELECTEDNOTFOCUS:
                    foreColor = SystemColors.WindowText;
                    break;

                case State.Item.TREIS_NORMAL:
                case State.Item.TREIS_HOT:
                    foreColor = SystemColors.WindowText;
                    break;

                default:
                    return(Unhandled);
                }

                // do not render, just modify text color
                poptions.dwFlags     |= NativeMethods.DTT.TextColor;
                poptions.iColorPropId = 0;
                poptions.crText       = ColorTranslator.ToWin32(foreColor);
                break;
            }
            }

            return(Unhandled);
        }
Exemple #5
0
        internal override void Apply(ref NativeMethods.DTTOPTS options)
        {
            options.dwFlags |= NativeMethods.DTTOPSFlags.DTT_SHADOWCOLOR |
                               NativeMethods.DTTOPSFlags.DTT_SHADOWOFFSET |
                               NativeMethods.DTTOPSFlags.DTT_SHADOWTYPE;

            options.crShadow       = ColorTranslator.ToWin32(Color);
            options.ptShadowOffset = new VistaControls.Native.POINT(Offset);

            switch (Type)
            {
            case ShadowType.None:
                options.iTextShadowType = (int)NativeMethods.TextShadowType.TST_NONE; break;

            case ShadowType.Single:
                options.iTextShadowType = (int)NativeMethods.TextShadowType.TST_SINGLE; break;

            case ShadowType.Continuous:
                options.iTextShadowType = (int)NativeMethods.TextShadowType.TST_CONTINUOUS; break;
            }
        }
Exemple #6
0
 public void Apply(ref NativeMethods.DTTOPTS options)
 {
     options.dwFlags      |= NativeMethods.DTTOPSFlags.DTT_APPLYOVERLAY;
     options.fApplyOverlay = Enabled;
 }
Exemple #7
0
 internal override void Apply(ref NativeMethods.DTTOPTS options)
 {
     options.dwFlags  |= NativeMethods.DTTOPSFlags.DTT_GLOWSIZE;
     options.iGlowSize = Size;
 }
 public void Apply(ref NativeMethods.DTTOPTS options)
 {
     options.dwFlags  |= NativeMethods.DTTOPSFlags.DTT_GLOWSIZE;
     options.iGlowSize = Size;
 }
Exemple #9
0
        public override int RenderTextEx(IntPtr htheme, IntPtr hdc, int partid, int stateid, string psztext, int cchtext, NativeMethods.DT dwtextflags, IntPtr prect, ref NativeMethods.DTTOPTS poptions)
        {
            // do not render, just modify text color
            var textColor = GetTextColor((States)stateid);

            poptions.crText   = ColorTranslator.ToWin32(textColor);
            poptions.dwFlags |= NativeMethods.DTT.TextColor;

            // proceed to default implementation with modified poptions parameter
            return(Unhandled);
        }
 internal abstract void Apply(ref NativeMethods.DTTOPTS options);
Exemple #11
0
 internal override void Apply(ref NativeMethods.DTTOPTS options)
 {
     options.dwFlags    |= NativeMethods.DTTOPSFlags.DTT_BORDERCOLOR | NativeMethods.DTTOPSFlags.DTT_BORDERSIZE;
     options.crBorder    = ColorTranslator.ToWin32(BorderColor);
     options.iBorderSize = BorderSize;
 }