1

I am using DateTimePicker tool in VB.net . When I build the project a red color mark is coming ( As Shown in screenshot ).

How to remove those red color marks ? Any properties for that ? That is looking odd. Thanks enter image description here

Edit1 : It is coming in both debug and release mode

Nitheesh Kedlaya
  • 147
  • 1
  • 10
  • Go to `Project > Properties > Application tab` and then tick the `Enable XP visual styles` checkbox. – 41686d6564 stands w. Palestine Nov 30 '20 at 12:42
  • The red mark indicates today's date and provides an easy way for the user to reset to today. That's why it says "Today" next to it. It's supposed to be there. On Windows 10, by default, it's a blue square instead of a red circle(ish). – jmcilhinney Nov 30 '20 at 12:42
  • 1
    It can be deactivated using the [Month Calendar Control Styles](https://learn.microsoft.com/en-us/windows/win32/controls/month-calendar-control-styles) if you set `MCS_NOTODAYCIRCLE` using the [SendMessage function (winuser.h)](https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-sendmessage) as shown [here](https://stackoverflow.com/questions/61696967/change-week-display-in-datetimepicker-control/61697311#61697311). The example is for C# so you would need to transfer that (or research how to use sendmessage) in VB.Net – Pᴇʜ Nov 30 '20 at 12:46
  • @jmcilhinney IIRC, it's the same even for Windows 7. I believe the OP just has visual styles disabled (judging by the appearance of the other controls as well). – 41686d6564 stands w. Palestine Nov 30 '20 at 12:48
  • @41686d6564, you are likely correct, although the question is whether visual styles are disabled intentionally or not. I think that it's been quite a while since VS didn't have visual styles turned on by default, so that may be an explicit decision. Even with visual styles turned on though, there will still be some sort of indicator for today's date. – jmcilhinney Nov 30 '20 at 12:57
  • @jmcilhinney Well but the indicator can be disabled as described in the link I posed above. – Pᴇʜ Nov 30 '20 at 13:00
  • See the notes and the methods used here: [How can I set the DateTimePicker dropdown to select Years or Months only?](https://stackoverflow.com/a/61287097/7444103). There's also a specific method, `ShowMonCalToday()`. – Jimi Nov 30 '20 at 14:48
  • Thank you all Enabling XP visual styles worked for me – Nitheesh Kedlaya Dec 01 '20 at 09:07

1 Answers1

1

As mentioned in the question comments, turning Enable XP visual styles on in Project properties/Application results in a DTP with a (much neater-looking) blue box around today's date:

enter image description here

To me this is somewhat anachronistic as I would have thought that having Enable XP visual styles off would result in the current OS (in my case Windows 10 Pro) determining the appearance. Windows XP just won't die, will it?

SteveCinq
  • 1,920
  • 1
  • 17
  • 22