Windows Ribbon Framework: How to change font face and size?

梦想与她 提交于 2019-12-03 13:14:57
George

Based on the behavior of Windows 7 Paint, this appears to not be possible. :)

bepe4711

I'm not exactly sure.. You're using the Windows Ribbon Framework in Delphi and got this strange behavior?

I've just started playing with the Framework but the Ribbon respects my preferences.

TUIApp = class(TInterfacedObject, IUIApplication)
...
gApp: TUIApp;
uiFrame: IUIFramework;
...
  CoCreateInstance(CLSID_UIRibbonFramework, nil, CLSCTX_INPROC_SERVER, IUIFramework, uiFrame);

  if Succeeded(uiFrame.Initialize(Handle, gApp)) then
  begin
     if not Succeeded(uiFrame.LoadUI(GetModuleHandle(nil), PChar('SIMPLERIBBON_RIBBON')))then
        sleep(5);
  end;

This is all what i do in my test project.

With 9pt:

And with 14pt:

Perhaps you change the wrong option? I've set the font size of the "Menu" element.

If you have further questions just ask...


I've just checked Win7 Paint. It does respect the user preferences. Therefore i guess you did something wrong or really changed the wrong option.


As requested the screenshot:

It looks likes we did the same. This is pretty strange...

If if you've actually tried to be helpful, and read all the way down to here, you'll realize this is the correct answer: it's not possible. So if you want a free 300 rep, you add that as an answer.

Since I can't post that as an answer (George got in there first :)), and since you seem to desperately need some kind of solution, I'm going to post the only other helpful answer or suggestion I can give to solve your problem: use a different ribbon control. You don't say why you're using this implementation instead of Delphi's own, or even one of the other Microsoft ones.

Two options are:

  • The inbuilt Delphi TRibbon control. I haven't used this in any publicly released apps, but I have in my own small / test programs and it is a little buggy in places. (I've seen odd drawing problems in the shortcut bar thing on the title bar, for example.) This may have improved in Delphi XE. It is possible it suffers from a similar bug. However, it's shipped with Delphi, "free" if you have Delphi, native code, VCL, and being a VCL component comes with the source so you can fix things if necessary.

  • The TMS ribbon control. I haven't used it but I have used another TMS control. That control is good, and their support fixes bugs quickly. (I've had confirmation of a bug in a day, so "immediately" counting timezones, and a new build released in a few days.)

I believe other component vendors may make ribbon components, and I do remember reading of someone making a SpTBXLib modification containing ribbon controls, but I haven't heard much about them. My suggestion is to use the TMS ribbon.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!