System.Windows.Forms.Form.AddOwnedForm(System.Windows.Forms.Form)

Here are the examples of the csharp api class System.Windows.Forms.Form.AddOwnedForm(System.Windows.Forms.Form) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

1. Example

Project: Bulk-Crap-Uninstaller
Source File: MainWindow.cs
View license
private void SetupAndShowLegendWindow()
        {
            if (IsDisposed || Disposing)
                return;

            _listLegendWindow.Show(this);
            AddOwnedForm(_listLegendWindow);

            _listLegendWindow.UpdatePosition(uninstallerObjectListView);
            Resize += (o, args) => _listLegendWindow.UpdatePosition(uninstallerObjectListView);
            Move += (o, args) => _listLegendWindow.UpdatePosition(uninstallerObjectListView);
            Controls[0].EnabledChanged += (o, args) => _listLegendWindow.Enabled = Controls[0].Enabled;

            var settings = _setMan.Selected;
            settings.Subscribe((x, y) => _listLegendWindow.Visible = y.NewValue, x => x.UninstallerListShowLegend, this);
            _listLegendWindow.VisibleChanged += (x, y) =>
            {
                if (!_listLegendWindow.Visible && settings.Settings.UninstallerListShowLegend)
                    settings.Settings.UninstallerListShowLegend = false;
            };
        }

2. Example

View license
public static SupportingFilesForm ShowForm(Form parent, BlogPostEditingManager editingManager)
        {
            SupportingFilesForm supportingFilesForm = new SupportingFilesForm();
            parent.AddOwnedForm(supportingFilesForm);
            supportingFilesForm.Show();
            Point location = parent.Location;
            Size size = parent.Size;
            supportingFilesForm.Location = new Point(location.X + size.Width + 2, location.Y);

            supportingFilesForm.BlogPostEditingManager = editingManager;
            return supportingFilesForm;
        }

3. Example

Project: ClearCanvas
Source File: PopupWindowHelper.cs
View license
public void ShowPopup(Form owner, Form popup, Point location)
		{

			this.owner = owner;
			this.popup = popup;

			// Start checking for the popup being cancelled
			Application.AddMessageFilter(filter);

			// Set the location of the popup form:
			popup.StartPosition = FormStartPosition.Manual;
			popup.Location = location; 
			// Make it owned by the window that's displaying it:
			owner.AddOwnedForm(popup);			
			// Respond to the Closed event in case the popup
			// is closed by its own internal means
			popClosedHandler = new EventHandler(popup_Closed);
			popup.Closed += popClosedHandler;

			// Show the popup:
			this.popupShowing = true;
			popup.Show();
			popup.Activate();
			
			// A little bit of fun.  We've shown the popup,
			// but because we've kept the main window's
			// title bar in focus the tab sequence isn't quite
			// right.  This can be fixed by sending a tab,
			// but that on its own would shift focus to the
			// second control in the form.  So send a tab,
			// followed by a reverse-tab.

			// Send a Tab command:
			keybd_event((byte) Keys.Tab, 0, 0, 0);
			keybd_event((byte) Keys.Tab, 0, KEYEVENTF_KEYUP, 0);

			// Send a reverse Tab command:
			keybd_event((byte) Keys.ShiftKey, 0, 0, 0);
			keybd_event((byte) Keys.Tab, 0, 0, 0);
			keybd_event((byte) Keys.Tab, 0, KEYEVENTF_KEYUP, 0);
			keybd_event((byte) Keys.ShiftKey, 0, KEYEVENTF_KEYUP, 0);


			// Start filtering for mouse clicks outside the popup
			filter.Popup = popup;
					
		}