简体   繁体   中英

Change tooltip c# winform of minimize maximize or close button

I am using DevExpress with Winform. is it possible to change tooltip of minimize maximize or close button in the top bar of my form in winform c#?

You can create your own Localizer class that inherits from DevExpress.XtraBars.Localization.BarLocalizer. Override the GetLocalizedString method and return what value you'd like for the minimize/maximize buttons. 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. I typically do this within the constructor:

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

This will work for both ribbons and XtraBar toolbars/XtraForms.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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