/// <summary> /// Shows the tips. /// </summary> /// <param name="rectControl">The rect control.</param> /// <param name="strMsg">The string MSG.</param> /// <param name="location">The location.</param> /// <param name="background">The background.</param> /// <param name="foreColor">Color of the fore.</param> /// <param name="fontSize">Size of the font.</param> /// <param name="autoCloseTime">The automatic close time.</param> /// <param name="parentForm">父窗体</param> /// <param name="blnTopMost">是否置顶</param> /// <returns>FrmAnchorTips.</returns> public static FrmAnchorTips ShowTips( Rectangle rectControl, string strMsg, AnchorTipsLocation location = AnchorTipsLocation.RIGHT, Color?background = null, Color?foreColor = null, int fontSize = 10, int autoCloseTime = 5000, Control parentControl = null, bool blnTopMost = true) { FrmAnchorTips frm = new FrmAnchorTips(rectControl, strMsg, location, background, foreColor, fontSize, autoCloseTime); frm.TopMost = blnTopMost; frm.Show(parentControl); //if (parentControl != null) //{ // parentControl.VisibleChanged += (a, b) => // { // try // { // Control c = a as Control; // if (CheckControlClose(c)) // { // frm.Close(); // } // } // catch (Exception ex) // { // } // }; //} return(frm); }
/// <summary> /// 功能描述:显示一个提示 English:Show a hint /// 作 者:HZH /// 创建日期:2019-08-29 15:29:07 /// 任务编号: /// </summary> /// <param name="rectControl">停靠区域</param> /// <param name="strMsg">消息</param> /// <param name="location">显示方位</param> /// <param name="background">背景色</param> /// <param name="foreColor">文字颜色</param> /// <param name="fontSize">文字大小</param> /// <param name="autoCloseTime">自动关闭时间,当<=0时不自动关闭</param> /// <returns>返回值</returns> public static FrmAnchorTips ShowTips( Rectangle rectControl, string strMsg, AnchorTipsLocation location = AnchorTipsLocation.RIGHT, Color?background = null, Color?foreColor = null, int fontSize = 10, int autoCloseTime = 5000) { FrmAnchorTips frm = new FrmAnchorTips(rectControl, strMsg, location, background, foreColor, fontSize, autoCloseTime); frm.TopMost = true; frm.Show(); return(frm); }
/// <summary> /// Shows the tips. /// </summary> /// <param name="rectControl">The rect control.</param> /// <param name="strMsg">The string MSG.</param> /// <param name="location">The location.</param> /// <param name="background">The background.</param> /// <param name="foreColor">Color of the fore.</param> /// <param name="fontSize">Size of the font.</param> /// <param name="autoCloseTime">The automatic close time.</param> /// <param name="parentForm">父窗体</param> /// <param name="blnTopMost">是否置顶</param> /// <returns>FrmAnchorTips.</returns> public static FrmAnchorTips ShowTips( Rectangle rectControl, string strMsg, AnchorTipsLocation location = AnchorTipsLocation.RIGHT, Color?background = null, Color?foreColor = null, int fontSize = 10, int autoCloseTime = 5000, Control parentControl = null, bool blnTopMost = true) { FrmAnchorTips frm = new FrmAnchorTips(rectControl, strMsg, location, background, foreColor, fontSize, autoCloseTime); frm.TopMost = blnTopMost; frm.Show(parentControl); if (parentControl != null) { parentControl.Disposed += (a, b) => { }; parentControl.VisibleChanged += (a, b) => { try { Control c = a as Control; if (CheckControlClose(c)) { frm.Close(); } } catch (Exception ex) { } }; parentControl.ParentChanged += (a, b) => { }; parentControl.HandleDestroyed += (a, b) => { }; } return(frm); }