views:

108

answers:

1

I would like to increase the font size of the standard (D2009) Ribbon controls, but I din't find a property to do it. Is it possible to change the font at all? When yes, how?

thanks

+1  A: 

TRibbon has a published Font property, I'd use that?

alt text

Just make sure you do not have any subcomponent of the ribbon selected, or when you do, press escape until the Object Inspector show the properties for the TRibbon itself.

Update (in response to comment)

It works for me, just tried it to make sure. I used a FontSelector from a component library (TMS Software), and setting Ribbon1.Font.Name to any valid font name (retrieved from the system by the font selector) such as "Verdana" or "Comic Sans MS" had an immediate visible effect on all text displayed on the Ribbon.

So:

Ribbon1.Font.Name = 'Comic Sans MS';

should do the trick, though to test it I would probably select a font (such as "Modern") for which the difference with Tahoma (the standard system font on most systems) is a bit more obvious.

Note: Haven't checked this, but I wouldn't be surprised if you can only use True Type fonts with the Ribbon.

Update

Andreas Rejbrand just pointed out that in my previous update I overlooked the fact that the OP wanted to change the size of the Font, not the font face (as identified by its name). Unfortunately, as it turns out, while of course the Font property has a size, changing that has indeed no effect at all... hmmm, why ever not?

Some investigation turned up the following

  • The Size of the Font does get changed
  • The Ribbon finally receives a CMFONTCHANGED message
  • Processing that messages makes the Ribbon change the font of all the ActionBars connected to the Ribbon
  • Then it starts a RebuildRibbonMetrics
  • It then proceeds to set Tabs[I].Page.Canvas.Font.Size := GetRibbonMetric(rmFontSize);
  • And GetRibbonMetric - lo and behold - returns 8, unconditionally, hard coded, not even a constant, just an integer literal.

Well, there is the reason why you can change the Ribbon's font size to your hearts content but it will never have any effect.

Why it was coded that way? Dunno. May have to ask Borcadero that through Quality Central. I have skimmed through the MS Ribbon Control Guidelines and can't remember seeing anything that says the Ribbon's font size should always be 8...

Marjan Venema
I already so that property, but it has no effect. Not sure if it is a bug or I don't understand it correctly.
max
Marjan is right when she says that you can indeed change the font of the Ribbon. But max is equally right when he says that you cannot change the font *size* of the Ribbon.
Andreas Rejbrand
Also, as a sidenote: Tahoma was the default system font on Windows XP, I believe, but in Windows Vista and Windows 7, Segoe UI is the default font. But the default font in Delphi is still (as of D2009) Tahoma.
Andreas Rejbrand
@Andreas: Oh, bugger, such a pesky tiny four-letter word... Read it, and somehow it instantly disappeared out of my awareness :/
Marjan Venema
Excellent analysis. +1
Andreas Rejbrand
Oh my, I just tried and you can change the *orientation* of the text, but not the size. That's funny.
Andreas Rejbrand
Now I see that the font size *is* actually respected in "reduced mode", that is, when the width of the window is too small to display all controls of the current Ribbon tab.
Andreas Rejbrand
Wait a minute... The more I look at the VCL source code, the more it seems to me like the Ribbon in Delphi *is not* the Windows 7 ribbon, but a `TCustomControl` implemented entirely in Delphi code. Is this true?!
Andreas Rejbrand
Btw: Never save a screenshot as JPG! They should be PNG! :)
Andreas Rejbrand
@Andreas: As far as I can tell, TRibbon does indeed seem to be implemented natively. As by the way is the Ribbon control from TMS Software (tmssoftware.com), I am looking at it now to see if that allows font size changes.
Marjan Venema
@Andreas: well, I have been changing all kinds of settings on the various font properties for the TAdvToolBar(Pager) controls. No effect. Could be me though, with these components you sometimes need to set a couple of properties correctly for everything to suddenly fall into place. Haven't checked whether it is 100% native or uses the OS implementation, but it would seem that their implementation is even more restrictive when it comes to font settings. Quite possibly because of MS rules and regulations. Who is to say... Could ask tms, but my dog tells me she needs to go out and then to bed...
Marjan Venema