Пример #1
0
        private void ShowBackground(Control control)
        {
            if (!this.IsDisposed)
            {
                Bitmap bitmap = WinInfoHelper.GetWindowCapture(control);
                this.BackgroundImage       = bitmap;
                this.BackgroundImageLayout = ImageLayout.Stretch;
                this.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom;

                control.Controls.Add(this);
                this.SetBounds(0, 0, control.ClientSize.Width, control.ClientSize.Height);
                this.BringToFront();
            }
        }
Пример #2
0
 private void DoAction(Control control)
 {
     try
     {
         _action.BeginInvoke(new AsyncCallback((o) =>
         {
             try
             {
                 _action.EndInvoke(o);
             }
             catch (Exception ex)
             {
                 log.Error("执行异常2:", ex);
                 WinInfoHelper.ShowInfoWindow(null, "执行异常:" + ex.Message);
             }
             try
             {
                 if (father != null)
                 {
                     father.Invoke(new Action(() =>
                     {
                         father = null;
                         timerShowBack.Stop();
                         control.Controls.Remove(this);
                         if (waiting != null)
                         {
                             waiting.Close();
                         }
                         this.Dispose();
                         if (this.BackgroundImage != null)
                         {
                             this.BackgroundImage.Dispose();
                         }
                     }));
                 }
             }
             catch (Exception ex)
             {
                 log.Error("销毁异常:", ex);
             }
         }), null);
     }
     catch (Exception ex)
     {
         log.Error("执行异常1:", ex);
     }
 }