Set DateTimePicker BackColor Property

Hi,
for those of you, who need a backcolored DateTimePicker
control:
this ist my implementation of the BackColor property for
the standard DateTimePicker Control (which does not work):
        public class MyDateTimePicker : DateTimePicker
        {
            #region internal set backcolor hack
            private Color _BackColor = SystemColors.Window;
            public override Color BackColor
            {
                get
                {
                    return _BackColor;
                }
                set
                {
                    _BackColor = value;
                    Invalidate();
                }
            }
            protected override void WndProc(ref Message m)
            {
                if (m.Msg == (int)0x0014 /* WM_ERASEBKGND */)
                {
                    Graphics g = Graphics.FromHdc(m.WParam);
                    g.FillRectangle(new SolidBrush(_BackColor),
                    ClientRectangle);
                    g.Dispose();
                    return;
                }
                base.WndProc(ref m);
            }
            #endregion
        }

…. seems to work quite well.
claudio

===========================================================

以上引于"http://www.pcreview.co.uk/forums/thread-1312925.php"