Pergunta

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

Foi útil?

Solução

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...

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top