Home > Blockchain >  Create TPanel which looks like TMainMenu?
Create TPanel which looks like TMainMenu?

Time:03-16

I want to create a component which looks similar to TMainMenu but is based on TPanel. TMainMenu under Windows 7 has a gradient of colors.

How can I achieve similar effect for TPanel? Not any gradient but a Windows gradient so it looks like a native component.

I also tried TMainMenu.PaintTo but this method is not available.

CodePudding user response:

This is actually easy thanks to the UxTheme API (uses UxTheme).

Using Screenshot of the drawn element in a new VCL form.

Of course, in a real application, you would refactor this. For instance, you wouldn't hardcode the 32 constant; instead, you'd determine the appropriate menu bar height given current DPI scaling,

  • Related