PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → How to find the width (in pixels) of the screen font?
How to find the width (in pixels) of the screen font?
Débuté par robert zhong, 07 oct. 2005 11:09 - 7 réponses
Posté le 07 octobre 2005 - 11:09
Hi, All,
I am remodifying the windev 9 Calendar example for my own use, but the layout of the "DATE" numbers does not look professional(they are left aligned between rows).
Now I want centralised those DATES (they are just dtext on the image control)so they look like the calendars found in Windows system calendar.
In short, if a font in displayed on screen , how do I know their widths or heights (pixels)?
Thank you very much
robert zhong
Posté le 07 octobre 2005 - 15:56
Hi Robert,
imho, in WinDev there is no way to know the width of a group of characters on screen. Though, for printed text, this is made possible by using iTextWidth() and iTextHeight()
However, the calendar example is no good because (test it!) it does not work well under different screen resolutions. We did not follow the path of this example anymore, because it does not take care of different screen resolutions, local holidays and calendar weeks.
If you want to have a (crude) example of a calendar project, send me a mail. Project is ~260kb in size, WinDev 8.
Kind regards,
Guenter
Hi, All,
I am remodifying the windev 9 Calendar example for my own use, but the layout of the "DATE" numbers does not look professional(they are left aligned between rows).
Now I want centralised those DATES (they are just dtext on the image control)so they look like the calendars found in Windows system calendar.
In short, if a font in displayed on screen , how do I know their widths or heights (pixels)?
Thank you very much
robert zhong
Posté le 08 octobre 2005 - 01:31
Hi Robert,
imho, in WinDev there is no way to know the width of a group of characters on screen. Though, for printed text, this is made possible by using iTextWidth() and iTextHeight()
However, the calendar example is no good because (test it!) it does not work well under different screen resolutions. We did not follow the path of this example anymore, because it does not take care of different screen resolutions, local holidays and calendar weeks.
If you want to have a (crude) example of a calendar project, send me a mail. Project is ~260kb in size, WinDev 8.
Kind regards,
Guenter
Hi, All,
I am remodifying the windev 9 Calendar example for my own use, but the layout of the "DATE" numbers does not look professional(they are left aligned between rows).
Now I want centralised those DATES (they are just dtext on the image control)so they look like the calendars found in Windows system calendar.
In short, if a font in displayed on screen , how do I know their widths or heights (pixels)?
Thank you very much
robert zhong

Hey Robert,
Why not use the standard Microsoft calendar control out of common controls DLL delivered with Windows. You can have all sorts of calendars. Very flexible and looks absolutely professional.
Regards,
Peter
Posté le 08 octobre 2005 - 04:53
Guenter and Peter
Thank you both.
Guenter , request mail sent, awaits your example
regards
robert zhong
Hi Robert,
imho, in WinDev there is no way to know the width of a group of characters on screen. Though, for printed text, this is made possible by using iTextWidth() and iTextHeight()
However, the calendar example is no good because (test it!) it does not work well under different screen resolutions. We did not follow the path of this example anymore, because it does not take care of different screen resolutions, local holidays and calendar weeks.
If you want to have a (crude) example of a calendar project, send me a mail. Project is ~260kb in size, WinDev 8.
Kind regards,
Guenter
Hi, All,
I am remodifying the windev 9 Calendar example for my own use, but the layout of the "DATE" numbers does not look professional(they are left aligned between rows).
Now I want centralised those DATES (they are just dtext on the image control)so they look like the calendars found in Windows system calendar.
In short, if a font in displayed on screen , how do I know their widths or heights (pixels)?
Thank you very much
robert zhong
Posté le 10 octobre 2005 - 20:04
"robert zhong" <robertzhong@yahoo.com> a écrit dans le message de news:
4346a036$3@news.pcsoft.fr...
Hi, All,
I am remodifying the windev 9 Calendar example for my own use, but the

layout of the "DATE" numbers does not look professional(they are left
aligned between rows).
> Now I want centralised those DATES (they are just dtext on the image
control)so they look like the calendars found in Windows system calendar.
In short, if a font in displayed on screen , how do I know their widths or

heights (pixels)?
Thank you very much
robert zhong


Hello Robert,

Did you check the TextWidth() and TextHeight() functions ? They return the
actual size of a text in pixels on the screen, depending of the font used in
the field.

Regards,

Michel Fages
Posté le 10 octobre 2005 - 20:06
Hi, All,
I am remodifying the windev 9 Calendar example for my own use, but the layout of the "DATE" numbers does not look professional(they are left aligned between rows).
Now I want centralised those DATES (they are just dtext on the image control)so they look like the calendars found in Windows system calendar.
In short, if a font in displayed on screen , how do I know their widths or heights (pixels)?
Thank you very much
robert zhong

Hello Robert,
Did you check the TextWidth() and TextHeight() functions ? They return the
actual size of a text in pixels on the screen, depending of the font used in
the field.
Regards,
Michel Fages
Posté le 11 octobre 2005 - 03:47
Hi, Michel
TextWidth and TextHeight only work with Edit Static and Combo controls, not Image controls,but your info provides a glim of hope that it might be possible to have an invisible edit controls just for measuring the text width before they are to be "dtexted" onto the image control, This is I am going to try today, will report back.
Good news though (at least we have a mean to measure screen font)
kind regards
robert zhong
Hi, All,
I am remodifying the windev 9 Calendar example for my own use, but the layout of the "DATE" numbers does not look professional(they are left aligned between rows).
Now I want centralised those DATES (they are just dtext on the image control)so they look like the calendars found in Windows system calendar.
In short, if a font in displayed on screen , how do I know their widths or heights (pixels)?
Thank you very much
robert zhong
Hello Robert,

Did you check the TextWidth() and TextHeight() functions ? They return the
actual size of a text in pixels on the screen, depending of the font used in
the field.
Regards,
Michel Fages
Posté le 11 octobre 2005 - 04:49
Hi, Michel and Guenter
It is working perfectly now, ALL "days" are now aligned in the middle, very professional. THANKS Michel!
Guenter, I am going to "steal" your ideas on marking Holidays, hope you don't mind?
Kind regards
robert zhong

Hi, All,
I am remodifying the windev 9 Calendar example for my own use, but the layout of the "DATE" numbers does not look professional(they are left aligned between rows).
Now I want centralised those DATES (they are just dtext on the image control)so they look like the calendars found in Windows system calendar.
In short, if a font in displayed on screen , how do I know their widths or heights (pixels)?
Thank you very much
robert zhong
Hello Robert,

Did you check the TextWidth() and TextHeight() functions ? They return the
actual size of a text in pixels on the screen, depending of the font used in
the field.
Regards,
Michel Fages