How to change the color of a check mark or 'mo

2019-07-17 15:56发布

I have a context menu that needs to use a dark background. It uses a check margin and has several sub-menus. The check mark and the arrow indicating a sub-menu are both black and thus hard to see. I can find no way to change the color. (It would seem obvious to me that they ought to use the ForeColor, which we have set to white for the text, but this does not seem to affect the check marks or arrows.)

Is there a way to do this?

EDIT: We are using images in the image margin as a work-around. But we have other problems with that and before trying to solve them, I thought I'd try to get a simpler solution to the basic problem.

1条回答
家丑人穷心不美
2楼-- · 2019-07-17 16:44

What I did in the past in similar cases was to "emulate" the checkbox by switching context menu images.

I.e. I remember whether the menu item is checked/unchecked (i.e. as a boolean inside the Tag of the menu item) and then change the picture appropriately to either a check image or no image, depending on the menu item's state.

Probably you could even derive your own class from MenuItem and change the check therein transparently to the user of the derived class.

For the arrow on the right, I assume you could emulate it by drawing an arrow with another font (Wingdings e.g.?) inside the area where the shortcuts are being displayed.

Or, as a completely different approach, use the owner draw functionality of the MenuItem.

查看更多
登录 后发表回答