ToolStrip 的 RenderMode 属性有什么用?
我一直不太明白这个房产的设计目的是什么。 我可以看到它明显改变了工具条的设计,并且我发现在 Windows XP 上将其设置为“系统”可以使其更适合 WinForms 风格。
这里面是不是还有什么更深层次的含义呢? 控件的呈现方式是否发生了变化?您建议使用哪种模式?
谢谢。
I never quite understood what this property was designed for. I can see that it visibly changes the design of the toolstrip and I find that setting it to System on Windows XP makes it fit much better with the WinForms style.
Is there some deeper meaning here? Does the way in which the control is rendered change at all and which mode would you recommend using?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
RenderMode 属性允许开发人员精确控制 ToolStrip(或 ContextMenu)的显示。 当您将 RenderMode 设置为 ManagerRenderMode 时,您可以创建一个自定义渲染器,该渲染器将允许您自定义 ToolStrip 的外观。 例如,下面的代码绘制一个灰色渐变作为 ContextMenu 中当前鼠标悬停在其上的项目的背景。
只需确保在表单加载事件或使用工具条之前调用的其他区域中,将自定义渲染器分配给工具条:
The RenderMode property allows the developer to precisely control the display of the ToolStrip (or ContextMenu). When you set the RenderMode to ManagerRenderMode, you can create a custom renderer that will allow you to customize the look of the ToolStrip. For example, the code below draws a gray gradient as the background of an the item in a ContextMenu that currently has the mouse over it.
Just make sure that in your Form Load event, or some other area that is called before the toolstrip is used, you assign your custom renderer to your toolstrip: