color of DateTimePicker?

Discussion in 'Questions (Windows Mobile)' started by Byak@, Jan 5, 2009.

  1. Byak@

    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
     
  2. agraham

    agraham Expert Licensed User

    I implemented BackColor and ForeColor before I found the following in the Remarks for each property in MSDN.

    :confused:
     
  3. Byak@

    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
     
  4. Byak@

    Byak@ Active Member Licensed User

    i found this cod...
    private class BackColorWorkaroundSubclass : NativeWindow
    Code:
    {
                
    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?
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice