ToolTipController 信息提示自定义内容和风格

写到一个公共类库中,要调用的地方实例化调用即可实现框框提示信息,如下图


       /// System.Windows.Forms的一个控件,在其上面提示显示
       /// 提示的标题默认(温馨提示)
       /// 提示的信息默认(???)
       /// 提示显示等待时间
       /// DevExpress.Utils.ToolTipType 显示的类型
       /// DevExpress.Utils.ToolTipLocation 在控件显示的位置
       /// 是否自动隐藏提示信息
       /// DevExpress.Utils.ToolTipIconType 显示框图表的类型
       /// 一个System.Windows.Forms.ImageList装载Icon图标的List,显示的ToolTipIconType上,可以为Null
       /// 图标在ImageList上的索引,ImageList为Null时传0进去
       public void NewToolTip(Control ctl, string title, string content,int showTime, DevExpress.Utils.ToolTipType toolTipType,DevExpress.Utils.ToolTipLocation tipLocation,boolisAutoHide,DevExpress.Utils.ToolTipIconTypetipIconType,System.Windows.Forms.ImageList imgList,intimgIndex)
       {
           try
           {
               MyToolTipClt = new DevExpress.Utils.ToolTipController();
               args = MyToolTipClt.CreateShowArgs();
               content = (string.IsNullOrEmpty(content) ? "???" : content);
               title=string.IsNullOrEmpty(title) ? "温馨提示" : title;
               MyToolTipClt.ImageList = imgList;
               MyToolTipClt.ImageIndex = (imgList == null ? 0 : imgIndex);
               args.AutoHide = isAutoHide;
               MyToolTipClt.ShowBeak = true;
               MyToolTipClt.ShowShadow = true;
               MyToolTipClt.Rounded = true;
               MyToolTipClt.AutoPopDelay = (showTime == 0 ? 2000 :showTime);
               MyToolTipClt.SetToolTip(ctl, content);
               MyToolTipClt.SetTitle(ctl, title);
               MyToolTipClt.SetToolTipIconType(ctl, tipIconType);
               MyToolTipClt.Active = true;
               MyToolTipClt.HideHint();
               MyToolTipClt.ShowHint(content, title, ctl, tipLocation);
           }
           catch(Exception ex)
           {
               CommonFunctionHeper.CommonFunctionHeper.CreateLogFiles(ex);
           }
       }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值