Solved

Sizing the TDateTimePicker Component

Posted on 2011-03-11
5
947 Views
Last Modified: 2012-05-11
I'm using the TDateTimePicker that is supplied with Delphi as one of the Win32 components. I've noticed that when one clicks on the drop-down button, the size of the calendar is rather large. I looked for a way to adjust the size of the calendar and couldn't find a property for that purpose. The font size property only governs the text in the box and has no apparent bearing on the size of the calendar. In fact, the only thing I can see that you can set with respect to the calendar are the colors. Is there a way I can reduce the size of the calendar drop down? It looks cartoonish and abnormal.
0
Comment
Question by:efz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 24

Expert Comment

by:jimyX
ID: 35112979
I think it's all about the font size as the width of the drop down window is determined by the size of the font.
You can test changing the size first to a big size and then set it to a smaller size and you will notice the window is having the size that is enough to accommodate the days.

For smaller font size you can try the Font "MS Serif" with size "7" or "Terminal" with "5".
0
 

Author Comment

by:efz
ID: 35116100
Unless I'm misunderstanding you or not finding the correct Font property, changing the font has nothing to do with how large the drop down calendar is. The font property only seems to govern the text in the display box only. Am I missing something? I'm beginning to suspect that the calendar size is related in some way to display resolution.
0
 
LVL 24

Accepted Solution

by:
jimyX earned 250 total points
ID: 35116594
>  "changing the font has nothing to do with how large the drop down calendar is"

Have you tried and tested by setting the font as I suggested? When the font size is 8 the drop down calender size differs than when it's 24:

Simple comparison without changing the display resolution:

MS Sans Serif - 8
MS Sans Serif - 24

>  "The font property only seems to govern the text in the display box only"

That's true, but the size of the drop down calender shrinks or expand according to the font size.

All Visual Controls' size is related to the display resolution.
0
 
LVL 32

Assisted Solution

by:Ephraim Wangoya
Ephraim Wangoya earned 250 total points
ID: 35119354

@jimyX
If you disable Runtime themes, then the font size of the component will affect the size of the calendar.
Or if you are using an older version of Delphi without a Manifest otherwise the font size will have no bearing on the calendar size


@efz
What version of Delphi are you using?
If you have runtime themes enabled, then it may as well be the system settings that affect the size of your calendar
(Resolution or Font Size etc)
0
 

Author Closing Comment

by:efz
ID: 35122593
Everything you guys said is true.

I don't have themes enabled and I'm using Delphi 2010.

Inspecting my code more carefully, I noticed that I was also setting the Height property and this may have the effect of generating a comparably-sized drop down calendar. I'm not sure, but it would seem that the Height property trumps the Font.Size property when it comes to the size of the drop down calendar.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

691 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