color of DateTimePicker?

Byak@

Active Member
Licensed User
in my app i'm use DateTimePicker.i'm try many libs with this control BUT color parametr doesn't work at all!but in mdsn you may see this parametr!why it doesn't work?
p.s. standart control @calendar@ has small functional
 

agraham

Expert
Licensed User
in mdsn you may see this parametr!why it doesn't work?
I implemented BackColor and ForeColor before I found the following in the Remarks for each property in MSDN.
Setting the BackColor has no effect on the appearance of the DateTimePicker ... Setting the ForeColor property has no effect on the appearance of the DateTimePicker control.

p.s. standart control @calendar@ has small functional
:confused:
 

Byak@

Active Member
Licensed User
This means not changing the color control, I understood?

Standard control "calendar" could change the color but has little functionality
 

Byak@

Active Member
Licensed User
i found this cod...
private class BackColorWorkaroundSubclass : NativeWindow
B4X:
        {
            private const int WM_ERASEBKGND = 0x0014;

            private Control _control;
            private SolidBrush _brush;

            private void OnHandleDestroyed(object sender, EventArgs e)
            {
                Detach();
            }

            public BackColorWorkaroundSubclass(Control control)
            {
                Attach(control);
            }

            public void Attach(Control control)
            {
                this._control = control;
                this._brush = new SolidBrush(this._control.BackColor);
                AssignHandle(this._control.Handle);
                this._control.HandleDestroyed += new EventHandler(OnHandleDestroyed);
            }

            public void Detach()
            {
                ReleaseHandle();
                this._brush = null;
            }

            protected override void WndProc(ref Message message)
            {
                if (message.Msg == WM_ERASEBKGND)
                {
                    using (Graphics graphics = Graphics.FromHdc(message.WParam))
                    {
                        graphics.FillRectangle(this._brush, this._control.ClientRectangle);
                    }
                }
                else
                {
                    base.WndProc(ref message);
                }
            }
        }
maybe it work in b4ppc?
 
Top