Here are the examples of the csharp api class System.Windows.Forms.Control.FindForm() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
200 Examples
0
1. Example
View licensepublic static bool GetRightToLeftLayout(Control control) { // Default to left-to-right layout bool rtl = false; // We need a valid control to find a top level form if (control != null) { // Search for a top level form associated with the control Form topForm = control.FindForm(); // If can find an owning form if (topForm != null) { // Use the form setting instead rtl = topForm.RightToLeftLayout; } } return rtl; }
0
2. Example
View licenseprivate void textOutputMenuItem_Click(object sender, System.EventArgs e) { SimpleSettingsDialog.Display( this.FindForm(), new TextOutputSettingsPage("Text Output") ); }
0
3. Example
View licenseprivate void InitControl( Control control ) { this.control = control; this.Owner = control.FindForm(); this.itemBounds = control.ClientRectangle; this.ControlBox = false; this.MaximizeBox = false; this.MinimizeBox = false; this.BackColor = Color.LightYellow; this.FormBorderStyle = FormBorderStyle.None; this.StartPosition = FormStartPosition.Manual; this.Font = control.Font; }
0
4. Example
View licenseprivate void textOutputMenuItem_Click(object sender, System.EventArgs e) { SimpleSettingsDialog.Display( this.FindForm(), new TextOutputSettingsPage("Text Output") ); }
0
5. Example
View licenseprivate void InitControl( Control control ) { this.control = control; this.Owner = control.FindForm(); this.itemBounds = control.ClientRectangle; this.ControlBox = false; this.MaximizeBox = false; this.MinimizeBox = false; this.BackColor = Color.LightYellow; this.FormBorderStyle = FormBorderStyle.None; this.StartPosition = FormStartPosition.Manual; this.Font = control.Font; }
0
6. Example
View licenseprivate void textOutputMenuItem_Click(object sender, System.EventArgs e) { SimpleSettingsDialog.Display( this.FindForm(), new TextOutputSettingsPage("Text Output") ); }
0
7. Example
View licenseprivate void InitControl( Control control ) { this.control = control; this.Owner = control.FindForm(); this.itemBounds = control.ClientRectangle; this.ControlBox = false; this.MaximizeBox = false; this.MinimizeBox = false; this.BackColor = Color.LightYellow; this.FormBorderStyle = FormBorderStyle.None; this.StartPosition = FormStartPosition.Manual; this.Font = control.Font; }
0
8. Example
View licensevoid ValidateControl(object sender, EventArgs args) { Form frm = _top.FindForm(); if (frm != null) { if (sender is Control && ((Control)sender).Focused) { Log.Verbose("{0} Changed: {1}", sender, ((Control)sender).Text); ((Control)sender).DataBindings.DefaultDataSourceUpdateMode = DataSourceUpdateMode.OnPropertyChanged; ((Control)sender).DataBindings[0].ControlUpdateMode = ControlUpdateMode.OnPropertyChanged; } } }
0
9. Example
View licenseprotected virtual void OnMaximizeClick(ControlBoxEventArgs e) { Parent.FindForm().WindowState = FormWindowState.Maximized; MaximizeClick?.Invoke(e); }
0
10. Example
View licenseprotected virtual void OnMinimizeClick(ControlBoxEventArgs e) { Parent.FindForm().WindowState = FormWindowState.Minimized; MinimizeClick?.Invoke(e); }
0
11. Example
View licenseprotected virtual void OnRestoredFormWindow(ControlBoxEventArgs e) { Parent.FindForm().WindowState = FormWindowState.Normal; RestoredFormWindow?.Invoke(e); }
0
12. Example
View licenseprivate void Keypress_Click(object sender, EventArgs e) { ExtendedControls.KeyForm kf = new ExtendedControls.KeyForm(); kf.Init(this.Icon, false, ",", buttonKeys.Text.Equals("?") ? "" : buttonKeys.Text); if ( kf.ShowDialog(FindForm()) == DialogResult.OK) { buttonKeys.Text = kf.KeyList; cd.fields[0].matchstring = kf.KeyList; cd.fields[0].matchtype = (kf.KeyList.Contains(",")) ? ConditionEntry.MatchType.IsOneOf : ConditionEntry.MatchType.Equals; } }
0
13. Example
View licenseprivate void OnKeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char) Keys.Return) this.FindForm().ActiveControl=null; }
0
14. Example
View licensepublic void SetCursor(Cursor z, object sender) { if (SE != null) DragInfo.Cursor = (sender as Control).FindForm().Cursor = z; }
0
15. Example
View licenseprivate void InitializeImmediateKeyboard() { // Create the device. keyboardDevice = new DInput.Device(SystemGuid.Keyboard); // grab the keyboard CooperativeLevelFlags excl = ownKeyboard ? CooperativeLevelFlags.Exclusive : CooperativeLevelFlags.NonExclusive; CooperativeLevelFlags background = (backgroundKeyboard && !ownKeyboard) ? CooperativeLevelFlags.Background : CooperativeLevelFlags.Foreground; keyboardDevice.SetCooperativeLevel(control.FindForm(), excl | background); // Set the data format to the keyboard pre-defined format. keyboardDevice.SetDataFormat(DeviceDataFormat.Keyboard); try { keyboardDevice.Acquire(); } catch { throw new Exception("Unable to acquire a keyboard using DirectInput."); } }
0
16. Example
View licenseprivate void InitializeBufferedKeyboard() { // create the device keyboardDevice = new DInput.Device(SystemGuid.Keyboard); // Set the data format to the keyboard pre-defined format. keyboardDevice.SetDataFormat(DeviceDataFormat.Keyboard); // grab the keyboard // For debugging, use the background flag so we don't lose input when we are in the debugger. // For release, use the foreground flag, so input to other apps doesn't show up here CooperativeLevelFlags excl = ownKeyboard ? CooperativeLevelFlags.Exclusive : CooperativeLevelFlags.NonExclusive; CooperativeLevelFlags background = (backgroundKeyboard && !ownKeyboard) ? CooperativeLevelFlags.Background : CooperativeLevelFlags.Foreground; keyboardDevice.SetCooperativeLevel(control.FindForm(), excl | background); // set the buffer size to use for input keyboardDevice.Properties.BufferSize = BufferSize; // note: dont acquire yet, wait till capture //try { // keyboardDevice.Acquire(); //} //catch { // throw new Exception("Unable to acquire a keyboard using DirectInput."); //} }
0
17. Example
View licenseprivate void InitializeImmediateMouse() { // create the device mouseDevice = new DInput.Device(SystemGuid.Mouse); mouseDevice.Properties.AxisModeAbsolute = true; // set the device format so DInput knows this device is a mouse mouseDevice.SetDataFormat(DeviceDataFormat.Mouse); CooperativeLevelFlags excl = ownMouse ? CooperativeLevelFlags.Exclusive : CooperativeLevelFlags.NonExclusive; CooperativeLevelFlags background = (backgroundMouse && !ownMouse) ? CooperativeLevelFlags.Background : CooperativeLevelFlags.Foreground; // set cooperation level mouseDevice.SetCooperativeLevel(control.FindForm(), excl | background); // note: dont acquire yet, wait till capture }
0
18. Example
View licenseprivate void InitializeBufferedMouse() { // create the device mouseDevice = new DInput.Device(SystemGuid.Mouse); mouseDevice.Properties.AxisModeAbsolute = true; // set the device format so DInput knows this device is a mouse mouseDevice.SetDataFormat(DeviceDataFormat.Mouse); // set the buffer size to use for input mouseDevice.Properties.BufferSize = BufferSize; CooperativeLevelFlags excl = ownMouse ? CooperativeLevelFlags.Exclusive : CooperativeLevelFlags.NonExclusive; CooperativeLevelFlags background = (backgroundMouse && !ownMouse) ? CooperativeLevelFlags.Background : CooperativeLevelFlags.Foreground; // set cooperation level mouseDevice.SetCooperativeLevel(control.FindForm(), excl | background); // note: dont acquire yet, wait till capture? //try { // mouseDevice.Acquire(); //} catch { // throw new Exception("Unable to acquire a mouse using DirectInput."); //} }
0
19. Example
View licenseprivate void InitControl( Control control ) { _control = control; Owner = control.FindForm(); ItemBounds = control.ClientRectangle; ControlBox = false; MaximizeBox = false; MinimizeBox = false; BackColor = Color.LightYellow; FormBorderStyle = FormBorderStyle.None; StartPosition = FormStartPosition.Manual; Font = control.Font; }
0
20. Example
View licenseprivate void btnMinimize_Click(object sender, System.EventArgs e) { FindForm().WindowState = FormWindowState.Minimized; }
0
21. Example
View licenseprivate void EditSelectedEntry() { if (SelectedEntry == null) return; try { using (new WaitCursor()) { GlossaryLinkItem revisedEntry = GlossaryManager.Instance.EditEntry(FindForm(), SelectedEntry.Text); if (revisedEntry != null) { listViewGlossary.CheckForDelete(revisedEntry.Text, listViewGlossary.SelectedItems[0]); // refresh contents of list-view item listViewGlossary.PopulateListItem(listViewGlossary.SelectedItems[0], revisedEntry); } // set focus to the list listViewGlossary.Focus(); } } catch (Exception ex) { UnexpectedErrorMessage.Show(ex); } }
0
22. Example
View licensepublic bool CheckSpelling() { // check spelling using (SpellCheckerForm spellCheckerForm = new SpellCheckerForm(SpellingChecker, EditorControl.FindForm(), false)) { // center the spell-checking form over the document body spellCheckerForm.StartPosition = FormStartPosition.CenterParent; // create word range // TODO: smarter word range for html //TextBoxWordRange wordRange = new TextBoxWordRange(_textBox, _textBox.SelectionLength > 0); HtmlTextBoxWordRange wordRange = new HtmlTextBoxWordRange(_textBox); // check spelling spellCheckerForm.CheckSpelling(wordRange); // return completed status return spellCheckerForm.Completed; } }
0
23. Example
View licenseprivate void DocumentEvents_GotFocus(object sender, EventArgs e) { Form form = FindForm(); if (form != null) form.ActiveControl = this; }
0
24. Example
View licenseprivate void buttonAdd_Click(object sender, EventArgs e) { try { using (new WaitCursor()) { string newBlogId = WeblogConfigurationWizardController.Add(FindForm(), false); if (newBlogId != null) { // add the weblog using (BlogSettings blogSettings = BlogSettings.ForBlogId(newBlogId)) { ListViewItem item = listViewWeblogs.AddWeblogItem(blogSettings); // select the item that was added listViewWeblogs.SelectedItems.Clear(); item.Selected = true; // set focus to the list listViewWeblogs.Focus(); } } return; } } catch (Exception ex) { UnexpectedErrorMessage.Show(ex); } }
0
25. Example
View licenseprivate void EditSelectedWeblog() { if (SelectedWeblog == null) return; try { using (new WaitCursor()) { WeblogSettingsManager.EditSettings(FindForm(), SelectedWeblog.Id, typeof(AccountPanel)); // refresh contents of list-view item listViewWeblogs.EditWeblogItem(listViewWeblogs.SelectedItems[0], SelectedWeblog); // set focus to the list listViewWeblogs.Focus(); // if we have an editing site then notify it that we // just edited weblog settings if (EditingSite != null) EditingSite.NotifyWeblogSettingsChanged(SelectedWeblog.Id, true); } } catch (Exception ex) { UnexpectedErrorMessage.Show(ex); } }
0
26. Example
View licenseprivate PostInfo[] GetRecentPostsSync(bool getPages) { try { using (new WaitCursor()) { if (getPages) return PostSource.GetPages(RecentPostRequest); else return PostSource.GetRecentPosts(RecentPostRequest); } } catch (Exception ex) { DisplayableExceptionDisplayForm.Show(FindForm(), ex); return new PostInfo[] { }; } }
0
27. Example
View licenseprivate void PostProperties_Execute(object sender, EventArgs e) { if (!Visible) return; if (postPropertiesForm.Visible) postPropertiesForm.Hide(); else postPropertiesForm.Show(FindForm()); }
0
28. Example
View licenseprivate void linkViewAll_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { if (e.Button != MouseButtons.Left) return; if (!postPropertiesForm.Visible) postPropertiesForm.Show(FindForm()); else { if (postPropertiesForm.WindowState == FormWindowState.Minimized) postPropertiesForm.WindowState = FormWindowState.Normal; postPropertiesForm.Activate(); } }
0
29. Example
View licensepublic bool ValidateInput(int maxValue) { if (!PixelPercent.IsAcceptableWidth(textBoxWidth.Text)) { DisplayMessage.Show(MessageId.UnspecifiedValue, this, Res.Get(StringId.Width)); textBoxWidth.Focus(); return false; } else if (ColumnWidth.Units != PixelPercentUnits.Undefined && ColumnWidth.Value <= 0) { DisplayMessage.Show(MessageId.InvalidNumberPositiveOnly, FindForm(), Res.Get(StringId.Width)); textBoxWidth.Focus(); return false; } else if (maxValue > 0 && ColumnWidth.Units != PixelPercentUnits.Undefined && ColumnWidth.Value >= maxValue) { DisplayMessage.Show(MessageId.ValueExceedsMaximum, FindForm(), maxValue, Res.Get(StringId.Width)); textBoxWidth.Focus(); return false; } else { return true; } }
0
30. Example
View licenseprivate void commandShowDisplayMessageTestForm_Execute(object sender, EventArgs e) { using (DisplayMessageTestForm form = new DisplayMessageTestForm()) { form.ShowDialog(FindForm()); } }
0
31. Example
View licenseprivate bool ValidateTitleSpecified() { if (_htmlEditor.Title == String.Empty) { if (_editingManager.BlogRequiresTitles) { // show error DisplayMessage.Show(MessageId.NoTitleSpecified, FindForm()); // focus the title and return false _htmlEditor.FocusTitle(); return false; } else if (PostEditorSettings.TitleReminder) { using (TitleReminderForm titleReminderForm = new TitleReminderForm(_editingManager.EditingPage)) { if (titleReminderForm.ShowDialog(FindForm()) != DialogResult.Yes) { _htmlEditor.FocusTitle(); return false; } } } } // got this far so the title must be valid return true; }
0
32. Example
View licensestatic GuiInfo GuiAssociatedInfo(Control control) { return control.FindForm().Tag as GuiInfo; }
0
33. Example
View licensevoid WinEventProc(IntPtr hWinEventHook, uint eventType, IntPtr hwnd, int idObject, int idChild, uint dwEventThread, uint dwmsEventTime) { // if we got the EVENT_SYSTEM_FOREGROUND, and the hwnd is the putty terminal hwnd (m_AppWin) // then bring the supperputty window to the foreground if (eventType == WinAPI.EVENT_SYSTEM_FOREGROUND && hwnd == m_AppWin) { // This is the easiest way I found to get the superputty window to be brought to the top // if you leave TopMost = true; then the window will always be on top. this.TopLevelControl.FindForm().TopMost = true; this.TopLevelControl.FindForm().TopMost = false; } }
0
0
35. Example
View licenseprivate void OnSelectBackgroundImage(object sender, EventArgs args) { string t = EditRenderProfile.SelectPictureFileByDialog(FindForm()); if (t != null) { _backgroundImageBox.Text = t; } }
0
36. Example
View licenseprivate void bPin_Click(object sender, EventArgs e) { FindForm().TopMost = !FindForm().TopMost; bPin.Image = FindForm().TopMost ? Properties.Resources.pinon : Properties.Resources.pinoff; }
0
37. Example
View licenseprivate void bExcel_Click(object sender, EventArgs e) { cmp.ToHTML(true, true, (FindForm() as FormResult).ResultPath, (FindForm() as FormResult).ResultFileName, onError: onError); }
0
38. Example
View licenseprivate void bHTML_Click(object sender, EventArgs e) { cmp.ToHTML(true, false, (FindForm() as FormResult).ResultPath, (FindForm() as FormResult).ResultFileName, onError: onError); }
0
39. Example
View licenseprivate void SourcePanel_Load(object sender, EventArgs e) { ParentView = (IView)FindForm(); sync = SynchronizationContext.Current; panelCommon.Dock = DockStyle.Top; panelCommon.BringToFront(); panelDatabase.Dock = DockStyle.Fill; panelDatabase.Visible = false; panelDatabase.BringToFront(); panelExcel.Dock = DockStyle.Fill; panelExcel.Visible = false; panelExcel.BringToFront(); panelCsv.Dock = DockStyle.Fill; panelCsv.Visible = false; panelCsv.BringToFront(); panelXml.Dock = DockStyle.Fill; panelXml.Visible = false; panelXml.BringToFront(); Dock = DockStyle.Fill; }
0
40. Example
View licenseprivate void ListDragSource_QueryContinueDrag(object sender, System.Windows.Forms.QueryContinueDragEventArgs e) { // Cancel the drag if the mouse moves off the form. ListBox lb = sender as ListBox; if (lb != null) { Form f = lb.FindForm(); // Cancel the drag if the mouse moves off the form. The screenOffset // takes into account any desktop bands that may be at the top or left // side of the screen. if (((Control.MousePosition.X - screenOffset.X) < f.DesktopBounds.Left) || ((Control.MousePosition.X - screenOffset.X) > f.DesktopBounds.Right) || ((Control.MousePosition.Y - screenOffset.Y) < f.DesktopBounds.Top) || ((Control.MousePosition.Y - screenOffset.Y) > f.DesktopBounds.Bottom)) { e.Action = DragAction.Cancel; } } }
0
41. Example
View licensevoid Reload(object sender, EventArgs e) { var parent = FindForm() as ViewOptMain; if (parent != null) { int? shopId = null; int? orderStateId = null; var shop = scbShop.SelectedItem as Shop; if (shop != null && shop.Id != -1) { shopId = shop.Id; } var orderState = scbOrderState.SelectedItem as OrderState; if (orderState != null && orderState.Id != -1) { orderStateId = orderState.Id; } parent.LoadOrderRecordPageList( PaginationOrderRecordList.PageIndex, PaginationOrderRecordList.PageSize, shopId, orderStateId); } }
0
0
43. Example
View licenseprivate Form FindFormEx() { Form form = FindForm(); if (form.MdiParent != null && form.WindowState == FormWindowState.Maximized) { form = form.MdiParent; } return form; }
0
44. Example
View licenseprivate void SetMeshDetailDialogInfo(Mesh mesh, string text) { if (_meshDiag == null) { _meshDiag = new MeshDetailsDialog(FindForm() as MainWindow, _scene); _meshDiag.FormClosed += (o, args) => { _meshDiag = null; }; _meshDiag.Show(); } else { _meshDiag.BringToFront(); } _meshDiag.SetMesh(mesh, text); }
0
45. Example
View licenseprivate void SetNodeDetailDialogInfo(Node node) { if (_nodeDiag == null) { _nodeDiag = new NodeItemsDialog(); _nodeDiag.FormClosed += (o, args) => { _nodeDiag = null; }; _nodeDiag.Show(); } else { _nodeDiag.BringToFront(); } _nodeDiag.SetNode(FindForm() as MainWindow, _scene, node); }
0
46. Example
View licenseprivate void textOutputMenuItem_Click(object sender, System.EventArgs e) { SimpleSettingsDialog.Display( this.FindForm(), new TextOutputSettingsPage("Text Output") ); }
0
47. Example
View licenseprivate void InitControl( Control control ) { this.control = control; this.Owner = control.FindForm(); this.itemBounds = control.ClientRectangle; this.ControlBox = false; this.MaximizeBox = false; this.MinimizeBox = false; this.BackColor = Color.LightYellow; this.FormBorderStyle = FormBorderStyle.None; this.StartPosition = FormStartPosition.Manual; this.Font = control.Font; }
0
48. Example
View licenseprivate void textOutputMenuItem_Click(object sender, System.EventArgs e) { SimpleSettingsDialog.Display( this.FindForm(), new TextOutputSettingsPage("Text Output") ); }
0
49. Example
View licenseprivate void InitControl( Control control ) { this.control = control; this.Owner = control.FindForm(); this.itemBounds = control.ClientRectangle; this.ControlBox = false; this.MaximizeBox = false; this.MinimizeBox = false; this.BackColor = Color.LightYellow; this.FormBorderStyle = FormBorderStyle.None; this.StartPosition = FormStartPosition.Manual; this.Font = control.Font; }
0
50. Example
View licenseprivate void textOutputMenuItem_Click(object sender, System.EventArgs e) { SimpleSettingsDialog.Display( this.FindForm(), new TextOutputSettingsPage("Text Output") ); }