Question DateTimePicker displayed value is shifted right

tim8w

Well-known member
Joined
Sep 8, 2020
Messages
130
Programming Experience
10+
Is there a way to get DateTimePicker to display the long format (or a custom format 'dddd, MMMM dd, yyyy') so that it is left-aligned?

What I get is:

-------------------------------------------
| ssssFridayssss , September 11, 2020 |
-------------------------------------------

where 's' means space (the forum strips out the extra spaces)

If I use a TextBox like this:

DateTime.Now.ToString("dddd, MMMM dd, yyyy")

I get the desired results:

------------------------------------
| Friday , September 11, 2020 |
------------------------------------

Thanks,
Tim
 

Sheepings,
I already know which format to use, I am just trying to get rid of all the necessary spaces. If I use long format (or a custom format 'dddd, MMMM dd, yyyy') I get 'sssssFriday,sssSeptember 11, 2020' in the display box.
 
The OP is asking about whitespace I put the red boxes over:
Screenshot_1.png
 
Oh sorry. I've been writing python, react, asp, c++ all week. So the owl brain is a bit frazzled.

Alternative is to write your own custom control or find one already made by someone else. It will be less work than learning to repaint the current one. Although if you were using WPF instead of forms, you'd not have this issue.
 
Yes, with WPF, if you don't like the way a control looks, just change the template used by the control.
 
Back
Top Bottom