public CharacterSelectPad(ICharacterSelectSource tool) { this.tool = tool; var page = Handler.CurrentPage; page.FontChanged += new EventHandler <EventArgs>(delegate { Update(); }).MakeWeak(e => page.FontChanged -= e); Handler.DrawAttributeChanged += new EventHandler <EventArgs>(delegate { Update(); }).MakeWeak(e => Handler.DrawAttributeChanged -= e); var layout = new DynamicLayout { Padding = Padding.Empty, Spacing = Size.Empty }; layout.Add(new Label { Text = "Char", HorizontalAlign = HorizontalAlign.Center, Font = new Font(SystemFont.Default, 7) }); layout.AddCentered(GradientPreview(), Padding.Empty, Size.Empty); layout.AddCentered(SelectButton(), new Padding(0, 5, 0, 0), Size.Empty); Content = layout; this.Update(); }
public LoadingForm() { var layout = new DynamicLayout(); Icon = Resources.GetProgramIcon(); Title = "Loading - arcdps Log Manager"; ClientSize = new Size(200, 80); Resizable = false; Content = layout; layout.BeginCentered(spacing: new Size(5, 5)); { layout.Add(null, yscale: true); layout.AddCentered("Loading the cache"); layout.AddCentered(new ProgressBar { Indeterminate = true }); layout.Add(null, yscale: true); } layout.EndCentered(); if (!Settings.LogRootPaths.Any()) { LoadComplete += (sender, args) => Task.Run(ShowInitialConfiguration); } else { LoadComplete += (sender, args) => Task.Run(LoadManager); } }
ColorDialogSection(bool showCreateDialog) { var layout = new DynamicLayout { Spacing = new Size(20, 20), DefaultSpacing = new Size(5, 5), Padding = new Padding(10) }; var btnCreateDialog = new Button { Text = "Use in Dialog" }; btnCreateDialog.Click += BtnCreateDialog_Click; layout.BeginCentered(); layout.Add(CreateAllowAlphaCheckBox()); layout.Add(PickColor()); layout.Add(PickColorWithStartingColor()); if (showCreateDialog) { layout.Add(btnCreateDialog); } layout.EndCentered(); layout.AddCentered(new ColorPicker()); layout.AddCentered(new TextBox()); layout.AddSpace(); Content = layout; }
public About() { this.Title = "About Eto Test"; #if DESKTOP this.Resizable = true; #endif var layout = new DynamicLayout(this, new Padding(20, 5), new Size(10, 10)); layout.AddCentered(new ImageView { Image = Icon.FromResource("Eto.Test.TestIcon.ico") }, true, true); layout.Add(new Label { Text = "Test Application", Font = new Font(SystemFont.Bold, 16), HorizontalAlign = HorizontalAlign.Center }); var version = Assembly.GetEntryAssembly().GetName().Version; layout.Add(new Label { Text = string.Format("Version {0}", version), Font = new Font(SystemFont.Default, 8), HorizontalAlign = HorizontalAlign.Center }); layout.Add(new Label { Text = "Copyright 2011 by Curtis Wensley aka Eto", Font = new Font(SystemFont.Default, 8), HorizontalAlign = HorizontalAlign.Center }); layout.AddCentered(CloseButton()); }
public SplitterSection() { var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5), Padding = new Padding(10) }; layout.Add(null); var xthemed = new CheckBox { Text = "Use Themed Splitter" }; layout.AddCentered(xthemed); layout.AddSeparateRow(null, Test1WithSize(), Test1AutoSize(), null); layout.AddSeparateRow(null, Test1WithFullScreenAndSize(), Test1FullScreenAndAutoSize(), null); layout.AddSeparateRow(null, Test2WithSize(), Test2AutoSize(), null); layout.AddCentered(TestDynamic()); layout.AddCentered(TestInitResize()); layout.AddCentered(TestHiding()); layout.Add(null); Content = layout; xthemed.CheckedChanged += (s, e) => { useThemed = xthemed.Checked == true; }; }
public BrushPad(Tools.Brush tool) { this.tool = tool; var page = Handler.CurrentPage; page.FontChanged += new EventHandler <EventArgs>(delegate { Update(); }).MakeWeak(e => page.FontChanged -= e); Handler.DrawAttributeChanged += new EventHandler <EventArgs>(delegate { Update(); }).MakeWeak(e => Handler.DrawAttributeChanged -= e); var layout = new DynamicLayout { Padding = Padding.Empty, Spacing = Size.Empty }; layout.Add(new Label { Text = "Brush", HorizontalAlign = HorizontalAlign.Center, Font = new Font(SystemFont.Default, 7) }); layout.AddCentered(GradientPreview(), Padding.Empty, Size.Empty); layout.BeginVertical(new Padding(2, 5), Size.Empty); layout.AddRow(UpButton(), null, DownButton()); layout.EndVertical(); layout.AddCentered(SelectButton(), Padding.Empty, Size.Empty); Content = layout; this.Update(); }
Control PickFontFamily() { var fontFamilyName = new TextBox { Text = "Times, serif", Size = new Size(200, -1) }; var button = new Button { Text = "Set" }; button.Click += (sender, e) => { try { UpdatePreview(new Font(fontFamilyName.Text, selectedFont.Size)); } catch (Exception ex) { Log.Write(this, "Exception: {0}", ex); } }; var layout = new DynamicLayout { Padding = Padding.Empty }; layout.BeginHorizontal(); layout.AddCentered(fontFamilyName, padding: Padding.Empty, spacing: Size.Empty); layout.AddCentered(button, Padding.Empty, Size.Empty); return(layout); }
void Init() { _textAreaInput = new TextArea(); _textAreaInput.Font = new Font(FontFamilies.Monospace, 10); _dropDownServices = new DropDown { Width = 200 }; _dropDownServices.SelectedIndexChanged += DropDownServicesSelectedIndexChanged; _radioButtonEncode = new RadioButton { Text = "Encode" }; _radioButtonEncode.CheckedChanged += _radioButtonEncode_CheckedChanged; _radioButtonDecode = new RadioButton(_radioButtonEncode) { Text = "Decode" }; _buttonRun = new Button { Text = "Run" }; _buttonRun.Click += _buttonRun_Click; _textAreaOutput = new TextArea(); _textAreaOutput.Font = new Font(FontFamilies.Monospace, 10); var inputLayout = new DynamicLayout { Padding = new Padding(5, 5, 5, 0), Spacing = new Size(5, 5) }; inputLayout.AddSeparateRow(_textAreaInput); var outputLayout = new DynamicLayout { Padding = new Padding(5, 5), Spacing = new Size(5, 5) }; outputLayout.BeginVertical(); outputLayout.BeginHorizontal(); outputLayout.AddCentered(_radioButtonEncode, horizontalCenter: false); outputLayout.AddCentered(_radioButtonDecode, horizontalCenter: false); outputLayout.Add(null); outputLayout.AddCentered(_dropDownServices, horizontalCenter: false); outputLayout.AddCentered(_buttonRun, horizontalCenter: false); outputLayout.EndHorizontal(); outputLayout.EndVertical(); outputLayout.AddSeparateRow(_textAreaOutput); var layout = new Splitter { Panel1 = inputLayout, Panel2 = outputLayout, Orientation = SplitterOrientation.Vertical, Position = 130 }; Content = layout; }
void OnBtnGitClicked(object s, EventArgs e) { Form git_confirm = new Form(); git_confirm.Title = "Git Functionality"; var layout = new DynamicLayout(git_confirm, new Padding(20, 5), new Size(10, 10)); layout.Add(new Label { Text = "Specify the Following Git Settings.", Font = new Font(SystemFont.Bold, 8), HorizontalAlign = HorizontalAlign.Center }); TextBox git_txt_box = new TextBox(); Button git_btn_ok = new Button { Text = "OK" }; ListBox git_display = new ListBox(); layout.AddCentered(git_txt_box); layout.AddCentered(git_btn_ok); layout.Add(git_display); git_btn_ok.Click += delegate { //Git Repo Test string directory = git_txt_box.Text; string repository = Repository.FindRepository(directory); Repository repo; IEnumerable <string> gitFileList = new HashSet <string>(); if (Repository.IsValid(repository)) { repo = new Repository(repository); gitFileList = repo.Index.Entries; git_display.Items.Clear(); //Display Untracked/Uncommitted Files foreach (var item in repo.Index.Status.Untracked) { git_display.Items.Add(item); } //Display Tracked/Committed Files foreach (var item in gitFileList) { git_display.Items.Add(item); } git_display.Items.Add(repo.Index.Status.Untracked.ToString()); } }; git_confirm.Show(); }
void Init() { //_textBoxUrl _textBoxUrl = new TextBox(); //_buttonReadFile _buttonReadFile = new Button { Text = StrRes.GetString("StrLoad", "Load") }; _buttonReadFile.Click += _buttonReadFile_Click; //_buttonSaveFile _buttonSaveFile = new Button { Text = StrRes.GetString("StrSave", "Save") }; _buttonSaveFile.Click += _buttonSaveFile_Click; //_textAreaBody _textAreaBody = new TextArea(); //rightMenu_Body var rightMenuBody = new ContextMenu(); var findCommand = new Command { MenuText = StrRes.GetString("StrFind", "Find"), Shortcut = Keys.F | Application.Instance.CommonModifier }; findCommand.Executed += findCommand_Executed; rightMenuBody.Items.Add(findCommand); var layout = new DynamicLayout { Padding = new Padding(5, 5), Spacing = new Size(5, 5) }; layout.BeginVertical(); layout.BeginHorizontal(); layout.AddCentered(_textBoxUrl, xscale: true, horizontalCenter: false); layout.AddCentered(_buttonReadFile, horizontalCenter: false); layout.AddCentered(_buttonSaveFile, horizontalCenter: false); layout.EndBeginHorizontal(); layout.EndVertical(); layout.AddRow(_textAreaBody); // bug in gtk2 layout.ContextMenu = rightMenuBody; layout.MouseUp += (sender, e) => { if (e.Buttons == MouseButtons.Alternate) { layout.ContextMenu.Show(_textAreaBody); } }; Content = layout; }
void OnApplicationClosing(object sender, System.ComponentModel.CancelEventArgs e) { Dialog confirm = new Dialog(); confirm.Title = "Confirm"; var layout = new DynamicLayout(confirm, new Padding(20, 5), new Size(10, 10)); layout.Add(new Label { Text = "Do You Want to Save Changes?", Font = new Font(SystemFont.Bold, 8), HorizontalAlign = HorizontalAlign.Center }); confirm.DefaultButton = new Button { Text = "No" }; confirm.AbortButton = new Button { Text = "Cancel" }; Button yes_DoSave = new Button { Text = "Yes" }; confirm.DefaultButton.Click += delegate { confirm.Close(); confirm.DialogResult = DialogResult.Yes; }; confirm.AbortButton.Click += delegate { confirm.DialogResult = DialogResult.Abort; }; yes_DoSave.Click += delegate { confirm.Close(); OnBtnSaveClick(sender, e); }; layout.AddCentered(confirm.DefaultButton); layout.AddCentered(confirm.AbortButton); layout.AddCentered(yes_DoSave); confirm.WindowState = WindowState.Normal; confirm.Closed += delegate { confirm.DialogResult = DialogResult.Abort; }; var result = confirm.ShowDialog(Parent); if (DialogResult.Abort == result) { e.Cancel = true; } }
public About() { this.Title = AltStrRes.AboutAltman; this.Resizable = false; //this.Size = new Size(300, 300); var layout = new DynamicLayout { Padding = new Padding(0, 0), Spacing = new Size(5, 5) }; layout.AddCentered(new ImageView { Image = Icons.AltmanAboutPng }, padding: null, xscale: true, yscale: false); //Version layout.Add(new Label { Text = "Version", Font = new Font(SystemFont.Bold, 10), }); layout.Add(new Label { Text = " " + AppEnvironment.AppVersion, Font = new Font(SystemFont.Default, 10), }); //License layout.Add(new Label { Text = "License", Font = new Font(SystemFont.Bold, 10), }); layout.Add(new Label { Text = " " + "Released under the GNU General Public License v2", Font = new Font(SystemFont.Default, 10), }); //Copyright layout.Add(new Label { Text = "Copyright", Font = new Font(SystemFont.Bold, 10), }); layout.Add(new Label { Text = " " + "(C) 2013-2014 by KeePwn", Font = new Font(SystemFont.Default, 10), }); layout.AddCentered(CloseButton()); Content = layout; }
void CreateControls() { var handler = this.Handler; //int charHeight = handler.CurrentPage.Font.Size.Height + 6; var characterSet = handler.Info.GetCharacterSet(handler.CharacterSet).ToList(); //int width = 40; //int height = charHeight * characterSet.Count + 18 + 17; //this.MinimumSize = new Size (width, height); var layout = new DynamicLayout { Padding = new Padding(10, 0) }; layout.BeginHorizontal(); //var layout = this.Layout as PixelLayout ?? new PixelLayout (this); //layout.Remove (this.Controls.ToArray ()); chars.Clear(); for (int i = 0; i < characterSet.Count; i++) { var character = new FontTextBox(handler, new Size(1, 1)); var label = new Label { }; //Size = new Size (width - character.Size.Width, charHeight)}; label.HorizontalAlign = HorizontalAlign.Right; label.VerticalAlign = VerticalAlign.Middle; label.Text = string.Format("F{0}", i + 1); layout.Add(label); //layout.Add (label, 0, i * charHeight); character.Tag = i; character.CanFocus = false; character.MouseDown += HandleCharacterMouseDown; layout.AddCentered(character, horizontalCenter: false, padding: Padding.Empty, spacing: Size.Empty); //layout.Add (character, width - character.Size.Width, i * charHeight + (charHeight - character.Size.Height) / 4); chars.Add(character); } layout.BeginVertical(Padding.Empty, Size.Empty); layout.Add(null); layout.Add(UpButton()); layout.Add(DownButton()); layout.Add(null); layout.EndVertical(); layout.AddCentered(SelectButton(), Padding.Empty, Size.Empty); layout.EndHorizontal(); Content = layout; Update(); }
public BrowseGroupView(BrowseGroupViewModel browseGroupViewModel, ImageService imageService, INavigator navigator, ColorService colorService) : base(imageService, navigator, "Back") { _browseGroupViewModel = browseGroupViewModel; DataContext = _browseGroupViewModel; var label = new Label() { Text = "Browse Group View" }; var image = new ImageView() { Image = new Bitmap(_browseGroupViewModel.GroupImage) }; if (image.Size.Width > 64) { image.Size = new Size(64, 64); } var joinButton = new Button() { Text = "Join" }; joinButton.BindDataContext(c => c.Visible, (BrowseGroupViewModel m) => m.CanJoin); joinButton.Command = _browseGroupViewModel.Join; var leaveButton = new Button() { Text = "Leave" }; leaveButton.BindDataContext(c => c.Visible, (BrowseGroupViewModel m) => m.CanLeave); leaveButton.Command = _browseGroupViewModel.Leave; var layout = new DynamicLayout(); layout.BeginVertical(); layout.Add(image); layout.Add(new Label() { Text = _browseGroupViewModel.Name, TextAlignment = TextAlignment.Center, Font = new Font(FontFamilies.Sans, 24) }); layout.AddCentered(joinButton); layout.AddCentered(leaveButton); layout.AddSpace(); ModalContent = layout; }
public DateTimePickerSection() { var layout = new DynamicLayout(); layout.BeginVertical(); layout.AddRow(new Label { Text = "Default" }, Default(), new Label { Text = "Default with Value" }, DefaultWithValue(), null); layout.AddRow(new Label { Text = "Date" }, DateControl(), new Label { Text = "Date with Value" }, DateControlWithValue()); layout.AddRow(new Label { Text = "Time" }, TimeControl(), new Label { Text = "Time with Value" }, TimeControlWithValue()); layout.AddRow(new Label { Text = "Date/Time" }, DateTimeControl(), new Label { Text = "Date/Time with Value" }, DateTimeControlWithValue()); layout.EndVertical(); layout.AddCentered(TestProperties()); // growing space at end is blank! layout.Add(null); Content = layout; }
public PixelOffsetModeSection() { var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5), Padding = new Padding(10) }; var pixelLayoutMode = new EnumDropDown <PixelOffsetMode> { SelectedValue = PixelOffsetMode.None }; var drawable = new Drawable { Size = new Size(600, 250) }; drawable.Paint += (sender, pe) => { pe.Graphics.FillRectangle(Brushes.Black, pe.ClipRectangle); pe.Graphics.PixelOffsetMode = pixelLayoutMode.SelectedValue; Draw(pe.Graphics); }; pixelLayoutMode.SelectedValueChanged += (sender, e) => drawable.Invalidate(); layout.AddCentered(pixelLayoutMode); layout.Add(drawable); Content = layout; }
public FontTypeSelector(RipHandler handler) { this.handler = handler; this.Title = "Font Style"; #if DESKTOP this.Resizable = true; #endif var layout = new DynamicLayout(); layout.Add(FontAndSizes(), true, true); layout.AddCentered(Preview(), horizontalCenter: true, verticalCenter: false, padding: Padding.Empty); layout.BeginVertical(Padding.Empty); layout.BeginHorizontal(); layout.Add(null, true); layout.Add(CancelButton()); layout.Add(OkButton()); layout.EndHorizontal(); layout.EndVertical(); Content = layout; }
Dialog CreateDialog() { var dialog = new Dialog(); var layout = new DynamicLayout(); layout.AddCentered(new Label { Text = "Content" }, yscale: true); dialog.DefaultButton = new Button { Text = "Default Button" }; dialog.AbortButton = new Button { Text = "Abort Button" }; dialog.DefaultButton.Click += delegate { MessageBox.Show("Default button clicked"); }; dialog.AbortButton.Click += delegate { MessageBox.Show("Abort button clicked"); }; layout.BeginVertical(); layout.AddRow(null, dialog.DefaultButton, dialog.AbortButton); layout.EndVertical(); dialog.Content = layout; return(dialog); }
Control Design() { var layout = new DynamicLayout(); layout.AddCentered(Grid(), xscale: true, yscale: false); layout.BeginVertical(Padding.Empty); layout.BeginHorizontal(); layout.Add(null, true); layout.Add(ClearAllButton()); layout.Add(InvertButton()); layout.Add(null, true); layout.EndHorizontal(); layout.EndVertical(); layout.BeginVertical(Padding.Empty); layout.BeginHorizontal(); layout.Add(MoveUpButton()); layout.Add(MoveDownButton()); layout.Add(MoveLeftButton()); layout.Add(MoveRightButton()); layout.EndHorizontal(); layout.EndVertical(); return(new GroupBox { Text = "Design", Content = layout }); }
private void CreateInputSection() { var inGrp = new GroupBox { Text = "Input" }; var layout = new DynamicLayout(inGrp); layout.BeginVertical(); _tabGroup = new TabControl(); var fileTab = CreateFromFileTab(); var deviceTab = CreateFromDeviceTab(); _tabGroup.TabPages.Add(deviceTab); _tabGroup.TabPages.Add(fileTab); layout.AddRow(_tabGroup); var parseButton = new Button { Text = "Parse" }; parseButton.Click += parseButton_Click; layout.BeginHorizontal(); layout.AddCentered(parseButton); layout.EndHorizontal(); layout.EndVertical(); _inputSection = inGrp; }
public CharacterSetEditor(CharacterHandler handler) { this.CharacterHandler = handler; this.Title = "Character Set Editor"; var layout = new DynamicLayout { Padding = 6, Spacing = new Size(6, 6) }; selected = CharacterHandler.CharacterSet; layout.AddCentered(CharacterSelection(), xscale: true, yscale: true); layout.Add(new Label { Text = "Click a character above, then select the character below to change it", Size = new Size(100, 32), HorizontalAlign = HorizontalAlign.Center }); layout.Add(Characters()); layout.Add(Buttons()); Content = layout; }
Control Preview() { var size = new Size(128, 128); var drawable = new Drawable { Size = size }; drawable.Paint += (sender, pe) => { if (canvas != null) { canvas.DrawRegion(pe.Graphics, new Rectangle(size)); } }; drawable.LoadComplete += delegate { canvas = new BGICanvas(drawable, size); DrawCanvas(); }; var layout = new DynamicLayout(); layout.AddCentered(drawable, verticalCenter: false); return(new GroupBox { Text = "Preview", Content = layout }); }
protected override Control OnDefineLayout() { _groups = new StackLayout { HorizontalContentAlignment = HorizontalAlignment.Center, Orientation = Orientation.Vertical, Spacing = 50 }; var centered = new DynamicLayout(); centered.AddCentered(_groups); CreateGroups(); var scrollable = new Scrollable { ExpandContentWidth = true, ExpandContentHeight = true, Border = BorderType.None, Padding = new Padding(10), Content = centered }; return(scrollable); }
public RuntimeSection() { var layout = new DynamicLayout(this); layout.AddCentered(ToggleButton()); layout.Add(MainTable()); }
void AddNewJourney() { var dialog = new Dialog(); dialog.DisplayMode = DialogDisplayMode.Attached; var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5) }; layout.AddCentered(new Label { Text = "Select the period of the new journey:" }, yscale: true); var dateTimePicker = new Calendar(); dateTimePicker.SelectedDate = DateTime.Now; dateTimePicker.Mode = CalendarMode.Range; layout.AddCentered(dateTimePicker); dialog.DefaultButton = new Button { Text = "Add" }; dialog.AbortButton = new Button { Text = "Cancel" }; dialog.DefaultButton.Click += delegate { MainViewModel.Add(dateTimePicker.SelectedRange.Start, dateTimePicker.SelectedRange.End); dialog.Close(); }; dialog.AbortButton.Click += delegate { dialog.Close(); }; layout.BeginVertical(); layout.AddRow(null, dialog.DefaultButton, dialog.AbortButton); layout.EndVertical(); dialog.Content = layout; dialog.ShowModal(this); }
public CharacterSelection(CharacterHandler handler) { this.Title = "Select Character"; this.CharacterHandler = handler; font = CharacterHandler.CurrentPage.Font; var layout = new DynamicLayout(); layout.AddCentered(Preview(), verticalCenter: false); layout.AddCentered(CharNum(), verticalCenter: false); layout.Add(Characters()); layout.BeginVertical(Padding.Empty); layout.AddRow(null, CancelButton(), OkButton()); layout.EndVertical(); Content = layout; }
public About() { this.Title = "About Eto Test"; this.Resizable = true; var layout = new DynamicLayout { Padding = new Padding(20, 5), Spacing = new Size(10, 10) }; layout.AddCentered(new ImageView { Image = TestIcons.TestIcon }, padding: null, xscale: true, yscale: true); layout.Add(new Label { Text = "Test Application", Font = new Font(SystemFont.Bold, 20), TextAlignment = TextAlignment.Center }); #if PCL var version = GetType().GetTypeInfo().Assembly.GetName().Version; #else var version = Assembly.GetEntryAssembly().GetName().Version; #endif layout.Add(new Label { Text = string.Format("Version {0}", version), Font = new Font(SystemFont.Default, 10), TextAlignment = TextAlignment.Center }); layout.Add(new Label { Text = "Copyright 2013 by Curtis Wensley aka Eto", Font = new Font(SystemFont.Default, 10), TextAlignment = TextAlignment.Center }); layout.AddCentered(CloseButton()); Content = layout; }
public RuntimeSection() { var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5), Padding = new Padding(10) }; layout.AddCentered(ToggleButton()); layout.Add(MainTable()); Content = layout; }
Control Vertical() { var control = SetInitialValue(); control.Size = new Size(-1, 150); control.Orientation = SliderOrientation.Vertical; var layout = new DynamicLayout(new Panel()); layout.AddCentered(control); return(layout.Container); }
void CreateChild() { if (child != null) { child.Close(); } child = new Form { Title = "Child Window", ClientSize = new Size(300, 200), WindowStyle = styleCombo.SelectedValue, WindowState = stateCombo.SelectedValue, Topmost = topMostCheckBox.Checked ?? false, Resizable = resizableCheckBox.Checked ?? false, Maximizable = maximizableCheckBox.Checked ?? false, Minimizable = minimizableCheckBox.Checked ?? false, ShowInTaskbar = showInTaskBarCheckBox.Checked ?? false }; var layout = new DynamicLayout(); layout.Add(null); layout.AddCentered(TestChangeSizeButton()); layout.AddCentered(TestChangeClientSizeButton()); layout.AddCentered(SendToBackButton()); layout.AddCentered(CloseButton()); layout.Add(null); child.Content = layout; child.WindowStateChanged += child_WindowStateChanged; child.Closed += child_Closed; child.Closing += child_Closing; child.Shown += child_Shown; child.GotFocus += child_GotFocus; child.LostFocus += child_LostFocus; child.LocationChanged += child_LocationChanged; child.SizeChanged += child_SizeChanged; bringToFrontButton.Enabled = true; child.Show(); // show that the child is now referenced Log.Write(null, "Open Windows: {0}", Application.Instance.Windows.Count()); }