Solved

Sizing the TDateTimePicker Component

Posted on 2011-03-11
5
848 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
  • 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:ewangoya
ewangoya 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
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.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

758 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

21 Experts available now in Live!

Get 1:1 Help Now