Lazarus: Get Default Font Size of Application and Controls
Question by Guest | 2015-10-30 at 22:41
I would like to somehow determine the default font size of my application. I mean the font size, that is used for all of the controls such as Panel, Edit fields, or listboxes.
I have tried to read out the font size with storing the value from Form1.Font.Size or Label1.Font.Size into a variable, but unfortunately, the result is always 0. Even during program execution, I get this 0 value, although the controls are having a font size that is visible.
What am I doing wrong here? And how to retrieve the correct value?
Related Topics
Fonts for Windows, Linux and Mac on the Web
Article | 0 Comments
MIME Types of Microsoft Office File Formats
Info | 0 Comments
CSS: Include CSS Stylesheets in HTML
Tutorial | 0 Comments
Lazarus: Determine Default-Font or System-Font of Form, Label, Edit and Button
Question | 3 Answers
HTML5 Canvas: Beginner Tutorial Chapter 4 - Write Text on Canvas
Tutorial | 0 Comments
Delphi/Lazarus: How to set up a Link to a Website in an Application
Tutorial | 0 Comments
Lazarus IDE: Font size adjusts automatically
Question | 1 Answer
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
If Font.Size is 0, that means, that the default font size should be used.
You can get the real size in the following way:
As you can see, I have written a small function for this, that should demonstrate how to proceed.
First of all, we are catching the FontData of the program and after that, we have to convert the value provided from this into the font size we can work with.
2015-11-01 at 17:04