Delphi XE with Aero effects causes paint issue

落花浮王杯 提交于 2019-12-04 02:56:58

I am able to reproduce the bug, here are some of the issues I discovered. Maybe they'll help someone figure this thing out.

  • If I place a button on the form and call Invalidate from the button's OnClick event, the form gets it's colors back.
  • If I place a place a timer on the form, enable the timer from WndProc on WM_SIZE with wParam = SIZE_MAXIMIZED, then call Invalidate from the timer the form gets it's colors back. This is essentially the same as the first method (calling Invalidate from a button), but the timer makes this automatic and ensures Invalidate is called only when there are no more messages to be processed. I tried the same with a simple PostMessage but didn't work (ie: I was probably Invalidate-ing too soon, and that's probably an other clue)
  • Interesting: If I make Application.MainFormOnTaskbar := False in the project's source, I no longer see the black form.

Workaround

The ribbon takes up the top part of the form. Place a TPanel on the rest of the form, make it Align = alClient and put everything on the Panel. The Black behind the panel is no longer visible!

You should enable glass frame when using Ribbon, because the Ribbon control is especially designed to work with aero glass frames on. Secondly you should do a little more work to configure your ribbon, adding an application menu, and some panes, to have it work as designed. I don't believe that "ribbon by itself" without any tab groups, or a system menu, is going to render properly at runtime.

If you want the ribbon to work on systems with Aero glass enabled, you should enable the glass frame property (Form.GlassFrame.Enabled) , and turn on Form.DoubleBuffered property, add some tab pages, add some tab groups, and add a system menu. Lots of steps.

Please try the attached ribbon starter project. (ribbonStarter.zip 88k)

Update If even my ribbonStarter produces the same result on your system, perhaps this should be logged in Quality Central. It is possibly a bug in your video driver, for which some code workaround in the ribbon and form code could be made.

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