how to wordwrap text in tooltip

前端 未结 5 2056
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-11 17:45

How to wordwrap text that need to be appear in ToolTip

5条回答
  •  北海茫月
    2021-01-11 18:17

    You can set the size of the tooltip using e.ToolTipSize property, this will force word wrapping:

    public class CustomToolTip : ToolTip
    {
        public CustomToolTip () : base()
        {
            this.Popup += new PopupEventHandler(this.OnPopup);
        }
    
        private void OnPopup(object sender, PopupEventArgs e) 
        {
            // Set custom size of the tooltip
            e.ToolTipSize = new Size(200, 100);
        }
    }
    

提交回复
热议问题