public void clearBK()
 {
     if (form != null)
     {
         if (!form.IsDisposed)
         {
             form.Close();
             form.Dispose();
         }
         form = null;
     }
 }
Example #2
0
        protected override void OnClosing(CancelEventArgs e)
        {
            Config.SetEditorPropertyGridPosition(editor.Location, XML_Editor);
            Config.SetEditorPropertyGridPosition(_toolBox.Location, XML_Toolbox);
            if (formHS != null)
            {
                if (!formHS.IsDisposed)
                {
                    formHS.Close();
                    formHS.Dispose();
                }
                formHS = null;
            }
            Form p = this.Parent as Form;

            if (p != null)
            {
                p.DialogResult = this.DialogResult;
                p.Close();
            }
        }
        public void InitBK()
        {
            if (form != null)
            {
                if (!form.IsDisposed)
                {
                    if (!this.Created)
                    {
                        form.Close();
                        form = null;
                    }
                    else
                    {
                        return;
                    }
                }
                else
                {
                    form = null;
                }
            }
            if (this.Created)
            {
                form          = new frmHotspots();
                form.TopLevel = true;
                form.TopMost  = true;
                form.SetCoverOwner(this);

                OnMove2();
                form.BackColor = form.TransparencyKey;
                form.Opacity   = CanvasOpacity;
                form.Show();
                form.Cursor  = CanvasCursor;
                form.TopMost = false;
                this.Visible = false;
                //
                form.MouseDown   += new MouseEventHandler(form_mousedown);
                form.MouseMove   += new MouseEventHandler(form_mousemove);
                form.MouseUp     += new MouseEventHandler(form_mouseup);
                form.KeyDown     += new KeyEventHandler(form_keydown);
                form.KeyUp       += new KeyEventHandler(form_keyup);
                form.DoubleClick += new EventHandler(form_mousedoubleclick);
                //
                System.Windows.Forms.Control ctrl = this.Parent;
                while (ctrl != null)
                {
                    ctrl.Move += new EventHandler(onPMove);
                    ctrl       = ctrl.Parent;
                }
                if (!bLinked)
                {
                    bLinked = true;
                    this.FindForm().VisibleChanged += new EventHandler(Hotspots_VisibleChanged);
                    this.FindForm().GotFocus       += new EventHandler(Hotspots_GotFocus);
                }
                if (!bHostVisible)
                {
                    form.Hide();
                }
            }
        }