How to set font size at runtime

hi,

Create a label on firemonkey form at runtime and set the label's font size to 20, but the label text's font size do not change.

procedure TForm1.FormShow(Sender: TObject);
var
  lb: TLabel;
begin
  lb:=TLabel.Create();
  lb.Text:='Hellow';
  lb.Parent:=Form1;
  lb.Font.Size:=20;
end;

anyone can help me to solve this question?

Best regards
0
guohai
1/28/2014 9:11:01 AM
embarcadero.delphi.firemonkey 4901 articles. 4 followers. Follow

2 Replies
3958 Views

Similar Articles

[PageSpeed] 28

guohai cui wrote:

> var
>   lb: TLabel;
> begin
>   lb:=TLabel.Create();
>   lb.Text:='Hellow';
>   lb.Parent:=Form1;
>   lb.Font.Size:=20;
> end;

In order to be able to change the font size you have to remove ssSize
from StyledSettings. Try this code:

{code}
procedure TForm6.FormCreate(Sender: TObject);
var
  lb: TLabel;
begin
  lb:=TLabel.Create(nil);
  lb.Text:='Hellow';
  lb.Parent:=self;
  lb.StyledSettings:=lb.StyledSettings-[TStyledSetting.ssSize];
  lb.Font.Size:=20;
end;
{code}
0
Lajos
1/28/2014 10:15:02 AM
Dear Lajos Juhasz,

Thank you very much! 
It's right to remove ssSize.
 

> {quote:title=Lajos Juhasz wrote:}{quote}
> guohai cui wrote:
> 
> > var
> >   lb: TLabel;
> > begin
> >   lb:=TLabel.Create();
> >   lb.Text:='Hellow';
> >   lb.Parent:=Form1;
> >   lb.Font.Size:=20;
> > end;
> 
> In order to be able to change the font size you have to remove ssSize
> from StyledSettings. Try this code:
> 
> {code}
> procedure TForm6.FormCreate(Sender: TObject);
> var
>   lb: TLabel;
> begin
>   lb:=TLabel.Create(nil);
>   lb.Text:='Hellow';
>   lb.Parent:=self;
>   lb.StyledSettings:=lb.StyledSettings-[TStyledSetting.ssSize];
>   lb.Font.Size:=20;
> end;
> {code}
0
guohai
1/29/2014 5:55:48 AM
Reply:

Similar Artilces:

Fonts & Fonts Size Settings
What Control the Fonts & Fonts Size Settings you see at the browser? I have deployed an application and found it is not WYSWYG for some PCs. The alignment of the GUI is completely off. This is strange that when my browser is connect to my development PC (XP), the alignment is fine. But when the same program is deployed at the App Server (Win2k3), the alignment is completely off. I didn't change my browser settings in between. Thanks in advance, SAM ...

How to set font size and font style for a THotkey control?
Now I add a Thotkey control on a form.Yes.It is a very useful control to handle hotkey. But how I can set a bigger font and bold style for it. Regards. Jack Xiao > {quote:title=bing xiao wrote:}{quote} > Now I add a Thotkey control on a form.Yes.It is a very useful control to handle hotkey. > But how I can set a bigger font and bold style for it. The THotkey is simply a wrapper around the Windows HOTKEY control. It gets it's font size and style from the user's display settings, using one of the system values (see ComCtrls.pas, procedure TCustomHotKey.AdjustHeight f...

How to set the default font size, font face in RTE?
Subject tells the question. Thanks for any help! http:/www.teamsybase.com/bruce.armstrong/rte_font.zip On Sun, 12 Nov 2000 13:02:14 +1100, in powersoft.public.powerbuilder.powerscript John Smith <johnjnrsmith@hotmail.com> wrote: >Subject tells the question. > >Thanks for any help! > > Bruce Armstrong [TeamSybase] mailto:Bruce.Armstrong@teamsybase.com Preach the gospel at all times. If necessary, use words. [Francis of Assisi] http://www.kidbrothers.org | http://www.fccwc.org http://www.harvest.org/knowgod/index.htm | http://www...

Can user control asp:TextBox font size by using browser text size setting
Virtually all elements on my web-pages font-size can be controlled by the user changing the text-size on the browser.   This does not work with the textbox control.  Is there something I am missing or does the presentation of font-size have to be controlled by CSS class through the use of themes.  I would rather not have to explain to the web user that they need to go to another page and choose a special theme to accomodate their text size choice. You can check the browser resolution on page preInit and then set a specific theme for your textboxes if you would like.  This would be what I would do.  Javascript would be your best bet for detecting screen resolution but I am not sure if there is another way to do that via .net.  I am sure this is but I haven't stumbled across it yet.  Hope this helps..... let me know if you need more info Joshua Folkerts To add to my above comments, Inside the themes, create a skin file that will handle the certain textboxes.  Themes, css, and skin files will get you where you need to go.  Here is a link on the profiles and themes. http://www.asp.net/learn/videos/view.aspx?tabid=63&id=44 Hope this helps JoshuaJoshua Folkerts Thanks Joshua What I have found is that if you set up CSS elements that have a font-size of 101% then the font-size adjusts properlly.  It appears that a "medium" font size is neutral and so is not recognized by the IE browser...

Sticky setting for font size
Name: Ketil Leister Duna Email: ketil_dunaathotmaildotcom Product: Firefox Summary: Sticky setting for font size Comments: For htpc environments and using different dpi settings, it would be nice to give firefox a default +/- font size setting. Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; nb-NO; rv:1.9) Gecko/2008052906 Firefox/3.0 From URL: http://hendrix.mozilla.org/ ...

Font Size Setting in Windows
We developed our application with the standard Windows display setting of Small Fonts. When an end user changes his Windows display setting to use Large Fonts, the actual text in our text objects increases, but the borders of those text objects remain the same. This effectively cuts off the text for many text and datawindow column objects. Any ideas on how to resolve this without reformatting every window and datawindow in the application? TIA, Mike ...

Contagious font size setting
Name: S Carey Product: Firefox Summary: Contagious font size setting Comments: In Firefox 3 Beta 5 it appears that the font size setting applies itself to other pages on the same domain as soon as the user switches to that tab. I'd prefer it retain the Firefox 2 functionality, where the font size is on a per-page basis. Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9b5) Gecko/2008032620 Firefox/3.0b5 From URL: http://hendrix.mozilla.org/ ...

superreview granted: [Bug 407415] NaNs in gfx*Font with font-size: 0 and font-size-adjust : [Attachment 293072] check for zero xHeight
Robert O'Callahan (:roc) <roc@ocallahan.org> has granted superreview: Bug 407415: NaNs in gfx*Font with font-size:0 and font-size-adjust https://bugzilla.mozilla.org/show_bug.cgi?id=407415 Attachment 293072: check for zero xHeight https://bugzilla.mozilla.org/attachment.cgi?id=293072&action=edit ------- Additional Comments from Robert O'Callahan (:roc) <roc@ocallahan.org> Should you also check that emHeight is nonzero in gfxWindowsFonts to ensure we don't divide by zero on it? I guess it should be equal to the requested font size which should be nonzero...

superreview granted: [Bug 428458] text input size="n" is too wide with monospace font : [Attachment 316186] patch, v.0.2, explicitly set Courier to be fixed-pitch font on mac
Robert O'Callahan (:roc) <roc@ocallahan.org> has granted John Daggett (:jtd) <jdaggett@mozilla.com>'s request for superreview: Bug 428458: text input size="n" is too wide with monospace font https://bugzilla.mozilla.org/show_bug.cgi?id=428458 Attachment 316186: patch, v.0.2, explicitly set Courier to be fixed-pitch font on mac https://bugzilla.mozilla.org/attachment.cgi?id=316186&action=edit ...

superreview requested: [Bug 428458] text input size="n" is too wide with monospace font : [Attachment 316186] patch, v.0.2, explicitly set Courier to be fixed-pitch font on mac
John Daggett (:jtd) <jdaggett@mozilla.com> has asked Vladimir Vukicevic (:vlad) <vladimir@pobox.com> for superreview: Bug 428458: text input size="n" is too wide with monospace font https://bugzilla.mozilla.org/show_bug.cgi?id=428458 Attachment 316186: patch, v.0.2, explicitly set Courier to be fixed-pitch font on mac https://bugzilla.mozilla.org/attachment.cgi?id=316186&action=edit ------- Additional Comments from John Daggett (:jtd) <jdaggett@mozilla.com> Based on Smokey's screenshots, setting Courier New as the default monospace font doesn...

Setting the default printing font size
Using the latest client when I adjust the font size in the "views" tab it does not change the printed font size of the message. The user has a plain text message I have set the view to be Arial 14, when printed it appears to be around Arial 8. Is there another spot to change the default printed text height? Justin Fisk Jfisk, It appears that in the past few days you have not received a response to your posting. That concerns us, and has triggered this automated reply. Has your problem been resolved? If not, you might try one of the following options: - Do a se...

setting font sizes *everywhere* in Thunderbird?
My problem comes from the fact that I also began to use TB on an EEE PC (under linux). Because the screen of that device is relatively small, real estate is expensive. One of the obvious way is to reduce the font size used up by programs like TB. Of course, there is an option panel for fonts and that includes setting the font size. However that seems to set the font for the message panel only, ie, where the mail itself is displayed. It does not seem to affect the other panels like: - fonts used in the menus - fonts used in the mailbox folder listing - fonts used in the list of ma...

Set Email Subject font and size
Hello every body ,  How i can set the email subject font and size. I have tried the following objMail.Subject ="<p style=Font-size=10pt;font-family:Arial> List of Monthly Reportable Communications</p>" and with Div , but no success.  The body style is working fine with <div> tag   Please help    You cannot do that.  Email subject is plain text and you cannot have any formatting.BruceDiscountASP.NET: Developer Ready ASP.NET Web Hosting- Microsoft Gold Certified Partner- Voted 2008, 2007, 2006 & 2005 Best ASP.NET Web Hostin...

set font size for excel sheet
Hi All, I am using OLE object to open and save my DW in Excel format. But the problem is the font size, it assigns default font and the row and cell size in the excel sheet is irregular, how do i set the font size for the file in Excel, i tried something like this but did not work, lO_Excel.ActiveWorkbook.Styles[1].Font.Size = 8 Thanks. ...

How to change FireMonkey Grid Font Size
*Hi;* I am gokhan from turkey.Because I newly using Rad studio platform , i completely have not adapted. In fact I have studied Delphi Platform (VCL) for 7 years , so I familiar to VCL platform. I working on a project which is simple. I really tried that *change Font Size , Style (etc) of grid , combobox* , but have not coped with it. Well Is there solution without Style Manager?? *Thanks.* Hello, here u find something about change Font, style... http://stackoverflow.com/questions/12454765/how-to-change-font-size-at-stringgrid-in-fm2 Greetings Matthias > {quote:title=g...

How to set font size in a Label control
I'm trying to specify a font size in a Label control, but the code I thought would work is giving me an error... "Cannot implicitly convert type 'System.Web.UI.WebControls.FontSize' to 'System.Web.UI.WebControls.FontUnit'".  The code causing the error:Label lbl = new Label(); lbl.Visible = true; lbl.Font.Size = FontSize.Small; lbl.Text = (string)schedule[e.Day.Date.ToShortDateString()]; e.Cell.Controls.Add(lbl);So the question is how do I need to encode a font size change?"Here's where the fun begins." -- Han Solo  Try the below ins...

changing default font size does not affect font size on form buttons and input fields.
Hello, in https://bugzilla.mozilla.org/show_bug.cgi?id=305109 I propose that changing the default font size in Preferences should also change the font sizes for form controls. On windows it works this way. Concerning Unix, though, the form controls keep their size, even if you adjust the default font size in Firefox preferences. This makes for ugly form controls if you do not adjust your GTK settings along with your Firefox default font size. But there is a workaround: you can also make Firefox scale the form controls by applying the following changes to 'font:' lines in res/forms.css: -moz-field -> small sans-serif -moz-fixed -> medium mono -moz-list -> small sans-serif -moz-button -> small sans-serif Still, I do not understand this discrepancy in rendering (Windows in contrast to Unix Firefox) as it obviously can be avoided. Now this bug is resolved WONTFIX, so I'd like to know why my proposal is objected. Can anybody please explain this to me? Cheers Daniel Kabs ...

font!font!font!
Name: robbie Product: Firefox Summary: font!font!font! Comments: Firefox font is bad !Very bad! The only reason I don't want to use firefox is font problem . I know how to change the font on firefox but it just not good enough. Internet explorer font is excellent.It also the only thing better than firefox. Browser Details: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Foxy/1; .NET CLR 1.1.4322) ...

Programmatic Setting of Font Attributes in FireMonkey Controls
A peculiarity I’m noticing in FireMonkey… Programmatic setting of Font attributes doesn’t work for certain controls, such as checkboxes, Labels, etc… The following code generates a compiler error in the Rad Studio XE Trial... CheckBox1.Font.Style:=[fsBold]; Label1.Font.Style:=[fsBold]; Strange that you can set the font attributes just fine through the Property Editor though! Seems as though the scope/visibility of the font.style definition is incorrectly set in FireMonkey. Could anyone running the full retail version of Delphi XE2 / RAD Studio XE2 verify if this issu...

Set tab page font size in code
Hi folks, how do i do this. I have tried mdiclient_tab.control[li_sheet].textsize = 8 and also mdiclient_tab.textsize = 8 Neither seems to work. TIA Tab page (or userobject acting as one) does not have a font property. The only property directly related to the appearance of text is TabTextColor > how do i do this. I have tried > mdiclient_tab.control[li_sheet].textsize = 8 and also > mdiclient_tab.textsize = 8 > > Neither seems to work. > TIA How do I set ther font size for the container that holds the pages them. At the moment, the pages are created a...

Need to set minimum any font size = 8pt
Hi. I need to set minimum font size for any applications to 8 pt. So if application wants to use 7 or 6, I anyway have to see 8 pt. Thanks for suggestions. -- nimnull22 ------------------------------------------------------------------------ Hi. If I add to fonts.conf: <match target="font" > <test compare="less" name="size" > <double>8</double> </test> <edit mode="assign" name="size" > <double>8</double> </edit> </match> Will it help to change a...

How to set font type and size in rtf control
Can i set the font type and size in rich text edit control programmaticaly. I mean not through the toolbar... Is there any function or some way to do it Take a look at Bruce Armstrong's example at http://www.teamsybase.com/bruce.armstrong/downloads.xml Daniel. <Naveed Chaudhry> wrote in message news:408f632a.4bf0.1681692777@sybase.com... > Can i set the font type and size in rich text edit control > programmaticaly. I mean not through the toolbar... > Is there any function or some way to do it ...

Changing font size of FireMonkey TStringGrid
I have a tStringGrid displayed on sample IOS app using XE4 but cannot find anyway to change the font size which is tiny by default and just about unreadable. Anyone know how this font size, type etc can be set? The tStringGrid control is really unusable unless it can be changed. Thanks > {quote:title=Matthew Shallvey wrote:}{quote} > I have a tStringGrid displayed on sample IOS app using XE4 but cannot find anyway to change the font size which is tiny by default and just about unreadable. Join the queue. My preferred method would be to create a custom style for TTextCell, ...

Setting font type and size of email body
When sending email in vb.net, how do you set the font type and size of the body of the email. The BodyFormat = MailFormat.Text....

Web resources about - How to set font size at runtime - embarcadero.delphi.firemonkey

Common Language Runtime - Wikipedia, the free encyclopedia
The Common Language Runtime ( CLR ) is the virtual machine component of Microsoft's .NET framework and is responsible for managing the execution ...

Runtime (@Runtimeapp) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Runtime - Simple Run Tracking on the App Store on iTunes
Get Runtime - Simple Run Tracking on the App Store. See screenshots and ratings, and read customer reviews.

HSA Foundation Launches ‘HSA 1.0 Final’ – Architecture, Programmers Reference and Runtime Specifications ...
... of the hardware, - the HSA Programmers’ Reference Manual for the software ecosystem targeting tools and compiler developers, - the HSA Runtime ...

ART: The Android runtime that will eventually replace Dalvik is in KitKat in preview form
Google has, for all intents and purposes, rewritten Android several times since first launching the platform back in 2008. But there's a part ...

The Verizon LG G3 has problems with ART — think twice before switching runtimes
... LG G3, particularly on Verizon. If you're the tinkering type who immediately runs to the developer options and enables the experiment ART runtime, ...

ART runtime Archives - Android Origin
The team behind the custom ROM, Paranoid Android, has just released a brand new beta. As always, it includes various bug fixes, but this update ...

runtime Archives - Android Police - Android News, Apps, Games, Phones, Tablets
... to make the experience between Android devices and Chromebooks seamless by allowing Android apps to run natively on Chrome (using App Runtime ...

Objective-C Runtime Reference
Describes the data structures and functions of the Objective-C runtime support library.

Apps can affect Mac performance, battery runtime, temperature, and fan activity - Apple Support
You can use Activity Monitor to see whether a Mac app is using more of the CPU than it should.

Resources last updated: 3/1/2016 12:27:39 PM