Ejemplo n.º 1
0
 /// <summary>
 /// 在指定控件附近显示消息
 /// </summary>
 /// <param name="controlOrItem">控件或工具栏项</param>
 /// <param name="text">消息文本</param>
 /// <param name="tipIcon">内置图标</param>
 /// <param name="delay">消息停留时长(毫秒)。指定负数则使用 DefaultDelay</param>
 public static void Show(Component controlOrItem, string text, TipIcon tipIcon = TipIcon.None, int delay = -1)
 {
     if (controlOrItem == null)
     {
         throw new ArgumentNullException("controlOrItem");
     }
     Show(text, CheckAndConvertTipIconValue(tipIcon), delay, GetCenterPosition(controlOrItem));
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 检测枚举值合法性并转换为Image
        /// </summary>
        private static Image CheckAndConvertTipIconValue(TipIcon tipIcon)
        {
            int i = (int)tipIcon;

            if (i < 0 || i > 3)
            {
                throw new InvalidEnumArgumentException("tipIcon", i, typeof(TipIcon));
            }
            return(_icons[i]);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 显示消息
 /// </summary>
 /// <param name="text">消息文本</param>
 /// <param name="tipIcon">内置图标</param>
 /// <param name="delay">消息停留时长(毫秒)。指定负数则使用 DefaultDelay</param>
 /// <param name="point">指定显示位置。为null则按活动控件</param>
 public static void Show(string text, TipIcon tipIcon = TipIcon.None, int delay = -1, Point?point = null)
 {
     Show(text, CheckAndConvertTipIconValue(tipIcon), delay, point);
 }