Пример #1
0
        /// <summary> 显示颜色
        /// </summary>
        /// <param name="ctl"></param>
        /// <param name="msg"></param>
        /// <param name="color"></param>
        public static void ShowMsg(Control ctl, string msg, Color color)
        {
            if (formMsg != null)
            {
                formMsg.Close();
                formMsg = null;
            }
            if (formBG == null || formBG.IsDisposed)
            {
                formBG = new FormBG();
            }
            //formBG.BringToFront();

            formMsg = new FormMessgeBox(msg, color);
            formBG.Show();
            //formBG.BringToFront();
            formBG.Size     = ctl.Size;
            formBG.Location = ctl.PointToScreen(new Point(0, 0));
            formMsg.Show();
            formMsg.Location = new Point(formBG.Location.X + (formBG.Width - formMsg.Width) / 2,
                                         formBG.Location.Y + (formBG.Height - formMsg.Height) / 2);
        }
Пример #2
0
        /// <summary> 显示颜色 
        /// </summary>
        /// <param name="ctl"></param>
        /// <param name="msg"></param>
        /// <param name="color"></param>
        public static void ShowMsg(Control ctl, string msg,Color color)
        {
            if (formMsg != null)
            {
                formMsg.Close();
                formMsg = null;
            }
            if (formBG == null || formBG.IsDisposed)
            {
                formBG = new FormBG();
            }                       
            //formBG.BringToFront();

            formMsg = new FormMessgeBox(msg,color);            
            formBG.Show();
            //formBG.BringToFront();
            formBG.Size = ctl.Size;
            formBG.Location = ctl.PointToScreen(new Point(0, 0));
            formMsg.Show();
            formMsg.Location = new Point(formBG.Location.X + (formBG.Width - formMsg.Width) / 2,
                formBG.Location.Y + (formBG.Height - formMsg.Height) / 2);            
        }