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