简体   繁体   English

更改工具提示 c# winform 的最小化最大化或关闭按钮

[英]Change tooltip c# winform of minimize maximize or close button

I am using DevExpress with Winform.我正在将 DevExpress 与 Winform 一起使用。 is it possible to change tooltip of minimize maximize or close button in the top bar of my form in winform c#?是否可以在 winform c# 中更改我的表单顶部栏中的最小化最大化或关闭按钮的工具提示?

You can create your own Localizer class that inherits from DevExpress.XtraBars.Localization.BarLocalizer.您可以创建自己的 Localizer class,它继承自 DevExpress.XtraBars.Localization.BarLocalizer。 Override the GetLocalizedString method and return what value you'd like for the minimize/maximize buttons.覆盖 GetLocalizedString 方法并返回您想要的最小化/最大化按钮的值。 For instance:例如:

public class MyRibbonLocalizer : DevExpress.XtraBars.Localization.BarLocalizer
{
    public override string Language
    {
        get
        {
            return System.Globalization.CultureInfo.CurrentCulture.Name;
        }
    }

    public override string GetLocalizedString(BarString id)
    {
        switch (id)
        {
            case BarString.MinimizeButton:
                return "My Minimize string";

            case BarString.MaximizeButton:
                return "My Maximize string";

            default:
                return base.GetLocalizedString(id);
        }
    }
}

You will need to register this localizer class in your RibbonForm in order for it to work.您需要在 RibbonForm 中注册此本地化程序 class 才能正常工作。 I typically do this within the constructor:我通常在构造函数中这样做:

DevExpress.XtraBars.Localization.BarLocalizer.Active = new MyRibbonLocalizer();

This will work for both ribbons and XtraBar toolbars/XtraForms.这适用于功能区和 XtraBar 工具栏/XtraForms。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM