写到一个公共类库中,要调用的地方实例化调用即可实现框框提示信息,如下图
/// 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);
}
}