How to custom colorize calendar days in the DateTimePicker control

Posted on 2012-09-04
Last Modified: 2012-10-02
I know that cracking open the DateTimePicker control and customizing it isn't possible.  I was,  however, wondering if I could wrap it or inherit from it in a way that allowed me to customize my own "colorDay" feature in calendar-mode.   I have no problem inheriting from the DateTimePicker control (if that is the best solution); the tricky part for me is actually color-coding the days programmatically.   Also this is an existing program that is in production, so I'd rather not swap it out for a totally unrelated control (even if that control behaved as described above).

Question by:David L. Hansen
    LVL 25

    Expert Comment

    LVL 15

    Author Comment

    by:David L. Hansen
    That looks like a great control, however, it didn't seem to have any features that I've described.
    LVL 25

    Accepted Solution

    I think I'd about prefer to write my on calendar than try to do it.  All controls are painted and I'm sure you can violate it by subclassing it and capturing messages, etc. but that would not be pretty and would require you drawing the days too I think.

    Here's the kind of stuff you'll be looking at if you subclass it:

    This looks awesome however, and may do what you need:

    Good luck!
    LVL 15

    Author Comment

    by:David L. Hansen
    That last link is perfect...Thanks

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
    Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now