예제 #1
0
 public static void ShowTip(this Control ctl, string content, ToolTipLocation tipLocation = ToolTipLocation.BottomCenter, ToolTipType toolTipType = ToolTipType.Standard, int showTime = 2000, bool isAutoHide = true, ToolTipIconType tipIconType = ToolTipIconType.Application, ImageList imgList = null, int imgIndex = 0)
 {
     try
     {
         var myToolTipClt = new ToolTipController();
         ToolTipControllerShowEventArgs args = myToolTipClt.CreateShowArgs();
         myToolTipClt.ImageList            = imgList;
         myToolTipClt.ImageIndex           = (imgList == null ? 0 : imgIndex);
         args.AutoHide                     = isAutoHide;
         myToolTipClt.Appearance.BackColor = Color.FromArgb(254, 254, 254);
         myToolTipClt.ShowBeak             = true;
         myToolTipClt.AllowHtmlText        = true;
         myToolTipClt.ShowShadow           = true;
         myToolTipClt.Rounded              = true;
         myToolTipClt.AutoPopDelay         = (showTime == 0 ? 2000 : showTime);
         myToolTipClt.SetToolTip(ctl, content);
         myToolTipClt.SetToolTipIconType(ctl, tipIconType);
         myToolTipClt.Active      = true;
         myToolTipClt.ToolTipType = toolTipType;
         myToolTipClt.HideHint();
         myToolTipClt.ShowHint(content, null, ctl, tipLocation);
     }
     catch (Exception ex)
     {
         LogUtil.WriteException(ex);
     }
 }
예제 #2
0
 /// <summary>
 /// 展现ToolTip
 /// </summary>
 /// <typeparam name="T">泛型</typeparam>
 /// <param name="t">控件</param>
 /// <param name="toolTip">ToolTipController</param>
 /// <param name="contnent">ToolTip内容</param>
 /// <param name="toolTipRule">委托</param>
 public static void ShowToolTip <T>(this T t, ToolTipController toolTip, string contnent, Action <ToolTipController> toolTipRule)
     where T : Control
 {
     toolTip.ShowBeak   = true;
     toolTip.ShowShadow = true;
     toolTip.Rounded    = true;
     toolTip.SetToolTipIconType(t, ToolTipIconType.Exclamation);
     if (toolTipRule != null)
     {
         toolTipRule(toolTip);
     }
     toolTip.ShowHint(contnent, t, ToolTipLocation.RightCenter);
 }
예제 #3
0
        /// <summary>
        /// 展现ToolTip
        /// </summary>
        /// <typeparam name="T">泛型</typeparam>
        /// <param name="control">控件</param>
        /// <param name="toolTip">ToolTipController</param>
        /// <param name="contnent">ToolTip内容</param>
        /// <param name="showTooltipFactory">委托</param>
        public static void ShowToolTip <T>(this T control, ToolTipController toolTip, string contnent, Action <ToolTipController> showTooltipFactory)
            where T : Control
        {
            toolTip.ShowBeak   = true;
            toolTip.ShowShadow = true;
            toolTip.Rounded    = true;
            toolTip.SetToolTipIconType(control, ToolTipIconType.Exclamation);

            if (showTooltipFactory != null)
            {
                showTooltipFactory(toolTip);
            }

            toolTip.ShowHint(contnent, control, ToolTipLocation.RightCenter);
        }