Exemplo n.º 1
0
        public void LookupFormInitialize(IFormInterface form)
        {
            IWindowsFormInterface localForm = (IWindowsFormInterface)form;

            localForm.BeginUpdate();
            try
            {
                localForm.Form.StartPosition = WinForms.FormStartPosition.Manual;
                localForm.IsLookup           = true;

                IWindowsFormInterface ownerForm = (IWindowsFormInterface)FindParent(typeof(IWindowsFormInterface));
                if (ownerForm != null)
                {
                    localForm.Form.Owner = (WinForms.Form)ownerForm.Form;
                    // LForm.Form.ShowInTaskbar = false;  this would be okay, except that alt-tab doesn't seem to work unless the owned form is also in the task bar
                }

                Size      natural = localForm.FormNaturalSize();
                Rectangle bounds  =
                    DAE.Client.Controls.LookupBoundsUtility.DetermineBounds
                    (
                        natural,
                        localForm.FormMinSize(),
                        Control
                    );
                localForm.Form.Bounds = bounds;
                if (bounds.Size == natural)
                {
                    localForm.Form.AutoResize = true;
                }
                localForm.Form.Activated += new EventHandler(LookupFormActivated);
            }
            finally
            {
                localForm.EndUpdate(false);
            }
        }
Exemplo n.º 2
0
 public void SetHostedForm(IWindowsFormInterface form, bool isOwner)
 {
     InternalClear();
     _hostedForm = (Form)form.Form;
     if (_hostedForm != null)
     {
         _isOwner = isOwner;
         if (!isOwner)
         {
             _originalLocation = _hostedForm.Location;
         }
         SuspendLayout();
         try
         {
             form.BeginUpdate();
             try
             {
                 _hostedForm.TopLevel = false;
                 Controls.Add(_hostedForm);
                 _hostedForm.SendToBack();
                 if (isOwner)
                 {
                     form.Show();
                 }
             }
             finally
             {
                 form.EndUpdate(false);
             }
         }
         finally
         {
             ResumeLayout(true);
         }
     }
 }