示例#1
0
        /// <summary>
        /// 窗体加载事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FormMessageBox_Load(object sender, EventArgs e)
        {
            _lblTitle.Text = "提示";
            if (_formMode == LoadMode.Error)
            {
                _lblTitle.Text = "错误";
                //this.plShow.BackgroundImage = global::CommonApp.Properties.Resources.error;    // 更换背景
            }
            else if (_formMode == LoadMode.Warning)
            {
                _lblTitle.Text = "警告";
                //this.plShow.BackgroundImage = global::CommonApp.Properties.Resources.warning;  // 更换背景
            }
            else
            {
                //this.plShow.BackgroundImage = global::CommonApp.Properties.Resources.Prompt;   // 更换背景
            }
            //this.lblMessage.Text = ShowMessage;
            int width  = Screen.PrimaryScreen.Bounds.Width;
            int height = Screen.PrimaryScreen.Bounds.Height;
            int top    = height - 35 - Height;
            int left   = width - Width - 5;

            Top     = top;
            Left    = left;
            TopMost = true;
            WindowsApi.AnimateWindow(Handle, 500, WindowsApi.AnimateWindowState.AwSlide + WindowsApi.AnimateWindowState.AwVerNegative);//开始窗体动画
            ShowInTaskbar        = false;
            _timerClose.Interval = 4000;
            _timerClose.Tick    += new EventHandler(Timer_Close_Tick);
            _timerClose.Start();
        }
示例#2
0
        /// <summary>
        /// 窗口已经关闭
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FormMessageBox_FormClosed(object sender, FormClosedEventArgs e)
        {
            WindowsApi.AnimateWindow(Handle, 1000, WindowsApi.AnimateWindowState.AwSlide + WindowsApi.AnimateWindowState.AwVerPositive + WindowsApi.AnimateWindowState.AwHide);


            _timerClose.Stop();
            _timerClose.Dispose();
        }