System.Windows.Forms.Control.ControlCollection.Contains(System.Windows.Forms.Control)

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

66 Examples 7

1. Example

Project: meridian59-dotnet
Source File: AdminInfoView.cs
View license
protected void OnAdminInfoObjectViewClose(object sender, EventArgs e)
        {
            foreach(TabPage tabPage in tabObjects.TabPages)
                if (tabPage.Controls.Contains((AdminInfoObjectView)sender))               
                    tabObjects.TabPages.Remove(tabPage);        
        }

2. Example

Project: OKHOSTING.UI
Source File: ControlList.cs
View license
public bool Contains(IControl item)
		{
			return InnerList.Contains((Native.Control) item);
		}

3. Example

Project: Legends-Viewer
Source File: CriteriaLine.cs
View license
public void ResizeSelf()
        {
            QueryOperatorSelect.Location = new Point(0, 0);
            PropertySelect.Location = new Point(QueryOperatorSelect.Right + 3, 0);
            ComparerSelect.Location = new Point(PropertySelect.GetRightSide() + 3, 0);
            ValueSelect.Location = new Point(ComparerSelect.Right + 3, 0);

            if (OrderByCriteria && Controls.Contains(ValueSelect))
                OrderBySelect.Location = new Point(ValueSelect.Right + 3, 0);
            else if (OrderByCriteria && Controls.Contains(ComparerSelect))
                OrderBySelect.Location = new Point(ComparerSelect.Right + 3, 0);
            else if (OrderByCriteria)
                OrderBySelect.Location = new Point(PropertySelect.GetRightSide() + 3, 0);


            if (OrderByCriteria)
                Insert.Location = new Point(OrderBySelect.Right + 15, 0);
            else
                Insert.Location = new Point(ValueSelect.Right + 15, 0);

            Remove.Location = new Point(Insert.Right + 3, 0);

            Width = Remove.Right;
            if (Parent != null) (Parent as CriteriaPanel).AutoResize();
        }

4. Example

Project: Legends-Viewer
Source File: CriteriaLine.cs
View license
public bool IsComplete()
        {
            if (!OrderByCriteria)
                return PropertySelect.SelectedIndex >= 0 && ComparerSelect.SelectedIndex >= 0 && ValueSelect.Text != "";
            bool complete = (PropertySelect.SelectedIndex >= 0) && (PropertySelect.GetLowestPropertyType().IsGenericType || PropertySelect.GetLowestPropertyType() == typeof(int) || PropertySelect.GetLowestPropertyType() == typeof(double) || PropertySelect.GetLowestPropertyType() == typeof(string) || PropertySelect.GetLowestPropertyType().IsEnum);
            if (Controls.Contains(ComparerSelect) && Controls.Contains(ValueSelect))
                complete = complete && ComparerSelect.SelectedIndex >= 0 && ValueSelect.Text != "";
            return complete;
        }

5. Example

Project: BloomDesktop
Source File: PublishView.cs
View license
private void UpdateSaveButton()
		{
			if (Controls.Contains(_epubPreviewControl))
				_saveButton.Text = LocalizationManager.GetString("PublishTab.SaveEpub", "&Save ePUB...");
			else
				_saveButton.Text = LocalizationManager.GetString("PublishTab.SaveButton", "&Save PDF...");
		}

6. Example

Project: Krypton
Source File: KryptonWorkspace.cs
View license
private void SetActiveCell(KryptonWorkspaceCell newCell)
        {
            // Check that we actually contain this cell
            if ((_activeCell != newCell) && Controls.Contains(newCell))
            {
                SetActiveCellRaw(newCell);
            }
        }

7. Example

Project: MaterialWinforms
Source File: DropDownControl.cs
View license
public void InitializeDropDown(Control dropDownItem)
        {
            if (_dropDownItem != null)
                throw new Exception("The drop down item has already been implemented!");
            _DesignView = false;
            _dropState = eDropState.Closed;
            this.Size = _AnchorSize;
            this._AnchorClientBounds = new Rectangle(2, 2, _AnchorSize.Width - 21, _AnchorSize.Height - 4);
            //removes the dropDown item from the controls list so it 
            //won't be seen until the drop-down window is active
            if (this.Controls.Contains(dropDownItem))
                this.Controls.Remove(dropDownItem);
            _dropDownItem = dropDownItem;
        }

8. Example

Project: IceChat
Source File: IceTabControl.cs
View license
internal void AddTabPage(IceTabPage page)
        {
            page.Dock = DockStyle.Fill;
            page.Location = new Point(0, 1);

            if (!this.Controls.Contains(page))
                this.Controls.Add(page);

            _previousTab = _currentTab;
            _currentTab = page;

        }

9. Example

Project: OpenLiveWriter
Source File: PreferencesForm.cs
View license
private void RemoveUnselectedPanels()
        {
            if (!initialized)
                return;

            for (int i = 0; i < preferencesPanelList.Count; i++)
            {
                if (i != sideBarControl.SelectedIndex && preferencesPanelList[i] != null)
                {
                    PreferencesPanel preferencesPanel = (PreferencesPanel)preferencesPanelList[i];
                    if (panelPreferences.Controls.Contains(preferencesPanel))
                        panelPreferences.Controls.Remove(preferencesPanel);
                }
            }
        }

10. Example

Project: winforms-modernui
Source File: MetroTile.cs
View license
public bool ActivateControl(Control ctrl)
        {
            if (Controls.Contains(ctrl))
            {
                ctrl.Select();
                activeControl = ctrl;
                return true;
            }

            return false;
        }

11. Example

Project: GEDKeeper
Source File: DropDownControl.cs
View license
public void InitializeDropDown(Control dropDownItem)
        {
            if (fDropDownItem != null)
                throw new Exception("The drop down item has already been implemented!");

            fDesignView = false;
            fDropState = DropDownState.Closed;

            Size = fAnchorSize;
            fAnchorClientBounds = new Rectangle(2, 2, fAnchorSize.Width - 21, fAnchorSize.Height - 4);

            // removes the dropDown item from the controls list so it
            // won't be seen until the drop-down window is active
            if (Controls.Contains(dropDownItem))
                Controls.Remove(dropDownItem);
            fDropDownItem = dropDownItem;
        }

12. Example

Project: AeroSuite
Source File: Display.cs
View license
internal virtual void ClearViewInternal()
        {
            if (this.view != null && this.Controls.Contains(this.view))
            {
                this.Controls.Remove(this.view);
            }

            this.view = null;
        }

13. Example

View license
private void SetActivePage(WizardPage newPage)
		{
			WizardPage oldActivePage = _activePage;

			// If this page isn't in the Controls collection, add it.
			// This is what causes the Load event, so we defer
			// it as late as possible.
			if (!pagePanel.Controls.Contains(newPage))
				pagePanel.Controls.Add(newPage);
			
			// Show this page.
			newPage.Visible = true;

			_activePage = newPage;
			CancelEventArgs e = new CancelEventArgs();
			newPage.OnSetActive(e);

			if (e.Cancel)
			{
				newPage.Visible = false;
				_activePage = oldActivePage;
			}

			// Hide all of the other pages.
			foreach (WizardPage page in _pages)
			{
				if (page != _activePage)
					page.Visible = false;
			}
		}

14. Example

View license
public void SetActivePage(WizardPage newPage)
		{
			WizardPage oldActivePage = _activePage;

			// If this page isn't in the Controls collection, add it.
			// This is what causes the Load event, so we defer
			// it as late as possible.
			if (!pagePanel.Controls.Contains(newPage))
				pagePanel.Controls.Add(newPage);
			
			// Show this page.
			newPage.Visible = true;

			_activePage = newPage;
			CancelEventArgs e = new CancelEventArgs();
			newPage.OnSetActive(e);

			if (e.Cancel)
			{
				newPage.Visible = false;
				_activePage = oldActivePage;
			}

			// Hide all of the other pages.
			foreach (WizardPage page in _pages)
			{
				if (page != _activePage)
					page.Visible = false;
			}
		}

15. Example

Project: Mist
Source File: MetroTile.cs
View license
public bool ActivateControl(Control ctrl)
        {
            if (Controls.Contains(ctrl))
            {
                ctrl.Select();
                activeControl = ctrl;
                return true;
            }

            return false;
        }

16. Example

Project: winauth
Source File: MetroTile.cs
View license
public bool ActivateControl(Control ctrl)
        {
            if (Controls.Contains(ctrl))
            {
                ctrl.Select();
                activeControl = ctrl;
                return true;
            }

            return false;
        }

17. Example

Project: xenadmin
Source File: QueryElement.cs
View license
private void RefreshSubQueryElements()
        {
            if (CurrentQueryType == null)
         /n ..... /n //View Source file for more details /n }

18. Example

Project: ClearCanvas
Source File: ImageBoxControl.cs
View license
private void AddExtensionControl(Control control)
		{
			if (Controls.Contains(control))
				return;

			// TODO: We should let extension decide if it wants to handle these events first
			control.MouseDown += OnExtensionMouseDown;
			control.KeyDown += OnExtensionKeyDown;
			control.KeyUp += OnExtensionKeyUp;
			Controls.Add(control);
		}

19. Example

View license
private void DisableEditMode()
        {
            if (this.Controls.Contains(TextBox))
            {
                this.Controls.Remove(TextBox);
            }
            if (!this.Controls.Contains(label))
            {
                this.Controls.Add(label);
            }
        }

20. Example

Project: XmlNotepad
Source File: NoBorderTabControl.cs
View license
void OnPageRemoved(object sender, PageEventArgs e) {
            NoBorderTabPage page = e.Page;
            tabs.TabPages.Remove(page.Page);
            if (this.Controls.Contains(page)) {
                this.Controls.Remove(page);
            }
        }

21. Example

Project: Launcher_Multigaming
Source File: FlatListBox.cs
View license
protected override void OnCreateControl()
		{
			base.OnCreateControl();
			if (!Controls.Contains(ListBx))
			{
				Controls.Add(ListBx);
			}
		}

22. Example

Project: Launcher_Multigaming
Source File: FlatTextBox.cs
View license
protected override void OnCreateControl()
		{
			base.OnCreateControl();
			if (!Controls.Contains(TB))
			{
				Controls.Add(TB);
			}
		}

23. Example

Project: Launcher_Multigaming
Source File: FlatListBox.cs
View license
protected override void OnCreateControl()
		{
			base.OnCreateControl();
			if (!Controls.Contains(ListBx))
			{
				Controls.Add(ListBx);
			}
		}

24. Example

Project: Launcher_Multigaming
Source File: FlatTextBox.cs
View license
protected override void OnCreateControl()
		{
			base.OnCreateControl();
			if (!Controls.Contains(TB))
			{
				Controls.Add(TB);
			}
		}

25. Example

Project: Launcher_Multigaming
Source File: FlatListBox.cs
View license
protected override void OnCreateControl()
		{
			base.OnCreateControl();
			if (!Controls.Contains(ListBx))
			{
				Controls.Add(ListBx);
			}
		}

26. Example

Project: Launcher_Multigaming
Source File: FlatTextBox.cs
View license
protected override void OnCreateControl()
		{
			base.OnCreateControl();
			if (!Controls.Contains(TB))
			{
				Controls.Add(TB);
			}
		}

27. Example

View license
public void Dispose()
        {
            _linkLabel.AccessibleName = null ;
            _linkLabel.AccessibleDescription = null ;
            _linkLabel.LinkClicked -=new LinkLabelLinkClickedEventHandler(_linkLabel_LinkClicked);
            TooltipText = null ;
            Caption = null ;
            if ( _parent.Controls.Contains(_linkLabel) )
                _parent.Controls.Remove(_linkLabel);
            Visible = false ;
            _linkLabel.Dispose();
        }

28. Example

Project: Legends-Viewer
Source File: CriteriaLine.cs
View license
private void ComparerChanged(object sender, EventArgs e)
        {
            if (ComparerSelect.SelectedIndex >= 0)
            {
                QueryComparer comparer = (QueryComparer)ComparerSelect.SelectedItem;
                if (comparer == QueryComparer.Min || comparer == QueryComparer.Max || comparer == QueryComparer.Average || comparer == QueryComparer.Sum)
                    Controls.Remove(ValueSelect);
                else if (!Controls.Contains(ValueSelect) && PropertySelect.Child != null && PropertySelect.Child.SelectedProperty != null && !PropertySelect.ContainsListLast())
                    Controls.Add(ValueSelect);
            }
        }

29. Example

Project: Legends-Viewer
Source File: CriteriaLine.cs
View license
public SearchInfo BuildSearchInfo(bool gettingValuesOnly = false)
        {
            if (!OrderBy/n ..... /n //View Source file for more details /n }

30. Example

Project: Repetier-Host
Source File: ThreeDControl.cs
View license
public void MakeVisible(bool vis)
        {
            //return;
            //Console.WriteLine("Vis = " + vis);
            if (vis)
            {
                if (!Controls.Contains(gl))
                    Controls.Add(gl);
                //gl.Dock = DockStyle.None;
                //gl.Width = 0;
                //gl.Height = 0;
            }
            else
            {
                if (Controls.Contains(gl))
                    Controls.Remove(gl);
                //gl.Dock = DockStyle.Fill;
            }
            gl.Visible = vis;
        }

31. Example

Project: FlatUI
Source File: FlatListBox.cs
View license
protected override void OnCreateControl()
		{
			base.OnCreateControl();
			if (!Controls.Contains(ListBx))
			{
				Controls.Add(ListBx);
			}
		}

32. Example

Project: FlatUI
Source File: FlatTextBox.cs
View license
protected override void OnCreateControl()
		{
			base.OnCreateControl();
			if (!Controls.Contains(TB))
			{
				Controls.Add(TB);
			}
		}

33. Example

View license
private void UpdateParent(Control parentControl)
        {
            // Is there a change in the d/n ..... /n //View Source file for more details /n }

34. Example

View license
private void UpdateParent(Control parentControl)
        {
            // Is there a change in the d/n ..... /n //View Source file for more details /n }

35. Example

View license
private void UpdateParent(Control parentControl)
        {
            // Is there a change in the n/n ..... /n //View Source file for more details /n }

36. Example

View license
private void UpdateParent(Control parentControl)
        {
            // Is there a change in the t/n ..... /n //View Source file for more details /n }

37. Example

View license
private void UpdateParent(Control parentControl)
        {
            // Is there a change in the t/n ..... /n //View Source file for more details /n }

38. Example

Project: referencesource
Source File: WorkflowView.cs
View license
bool IMessageFilter.PreFilterMessage(ref Message m)
        {
            bool handled = false;
            if (m.Msg == NativeMethods.WM_KEYDOWN || m.Msg == NativeMethods.WM_SYSKEYDOWN ||
                m.Msg == NativeMethods.WM_KEYUP || m.Msg == NativeMethods.WM_SYSKEYUP)
            {
                Control control = Control.FromHandle(m.HWnd);
                if (control != null && (control == this || Controls.Contains(control)))
                {
                    KeyEventArgs eventArgs = new KeyEventArgs((Keys)(unchecked((int)(long)m.WParam)) | ModifierKeys);
                    if (m.Msg == NativeMethods.WM_KEYDOWN || m.Msg == NativeMethods.WM_SYSKEYDOWN)
                        OnKeyDown(eventArgs);
                    else
                        OnKeyUp(eventArgs);

                    handled = eventArgs.Handled;
                }
            }

            return handled;
        }

39. Example

Project: Urbanization
Source File: MainForm.cs
View license
private void ReloadGamePanel()
        {
            if (_gamePanel != null && Controls.Contains(_gamePanel))
            {
                Controls.Remove(_gamePanel);
            }

            _gamePanel = new Panel();

            Controls.Add(_gamePanel);
            _gamePanel.BringToFront();
            _gamePanel.Dock = DockStyle.Fill;
        }

40. Example

Project: XrmToolBox
Source File: Worker.cs
View license
public void SetWorkingMessage(Control host, string message, int width = 340, int height = 150)
        {
            if (string.IsNullOrEmpty(message))
            {
                return;
            }

            if (host.Controls.Contains(_infoPanel))
            {
                if (_infoPanel.Width != width || _infoPanel.Height != height)
                {
                    _infoPanel.Dispose();
                    host.Controls.Remove(_infoPanel);
                    _infoPanel = InformationPanel.GetInformationPanel(host, message, width, height);
                }
                else
                {
                    InformationPanel.ChangeInformationPanelMessage(_infoPanel, message);
                }
            }
            else
            {
                _infoPanel = InformationPanel.GetInformationPanel(host, message, width, height);
            }
        }

41. Example

Project: poderosa
Source File: Util.cs
View license
public static void ReplaceControl(Control parent, Control src, Control dest) {
            Debug.Assert(src.Parent == parent);
            Size size = src.Size;
            DockStyle dock = src.Dock;
            Point location = src.Location;

            Control[] t = new Control[parent.Controls.Count];
            for (int i = 0; i < t.Length; i++) {
                Control c = parent.Controls[i];
                t[i] = c == src ? dest : c;
            }
            dest.Dock = dock;
            dest.Size = size;
            dest.Location = location;
            parent.Controls.Clear();
            parent.Controls.AddRange(t);
            Debug.Assert(parent.Controls.Contains(dest));
        }

42. Example

Project: Tomato
Source File: MemoryDisplay.cs
View license
private void MemoryDisplay_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            Font font = new Font(FontFamily.GenericMonospace, 12);
            if (this.Controls.Contains(textBox))
                this.Controls.Remove(textBox);
            Size cell = TextRenderer.MeasureText("0000", font);
            Size gutter = TextRenderer.MeasureText("0000:", font);
            gutter.Width += 2;
            cell.Height += 2;
            if (e.X > gutter.Width)
            {
                textBox = new TextBox();
                ushort address =(ushort)(
                    (e.Y / cell.Height) * wordsWide +
                    ((e.X - gutter.Width) / cell.Width)
                    + SelectedAddress);
                textBox.Tag = address;
                textBox.KeyDown += textBoxRegisterX_KeyDown;
                textBox.Location = new Point(
                    ((e.X - gutter.Width) / cell.Width) * cell.Width + gutter.Width,
                    e.Y / cell.Height * cell.Height);
                textBox.Text = Debugger.GetHexString(CPU.Memory[address], 4);
                textBox.Size = cell;
                textBox.MaxLength = 4;
                this.Controls.Add(textBox);
            }
        }

43. Example

Project: Tomato
Source File: MemoryDisplay.cs
View license
private void MemoryDisplay_MouseClick(object sender, MouseEventArgs e)
        {
            if (this.Controls.Contains(textBox))
                this.Controls.Remove(textBox);

            Size cell = TextRenderer.MeasureText("0000", this.Font);
            Size gutter = TextRenderer.MeasureText("0000:", this.Font);
            gutter.Width += 2;
            cell.Height += 2;
            outlinedAddress = (ushort)(
                (e.Y / cell.Height) * wordsWide +
                ((e.X - gutter.Width) / cell.Width)
                + SelectedAddress);
            this.Invalidate();
        }

44. Example

Project: SquareOne
Source File: TextAreaControl.cs
View license
private void SetScrollBars()
    {
      if (_textArea.TextEditorProperties.ShowScrollBars)
      {
        if (!Controls.Contains(_hScrollBar))
          Controls.Add(_hScrollBar);

        if (!Controls.Contains(_vScrollBar))
          Controls.Add(_vScrollBar);

        ResizeTextArea();
      }
      else
      {
        if (Controls.Contains(_hScrollBar))
          Controls.Remove(_hScrollBar);

        if (Controls.Contains(_vScrollBar))
          Controls.Remove(_vScrollBar);

        ResizeTextArea();
      }
    }

45. Example

View license
private void ShowPage(ContainerPage page)
		{
			// get the control to show
			var toShow = (Control)_component.GetPageView(page).GuiElement;

			// hide all others
			foreach (var c in this.Controls.Cast<Control>().Where(c => c != toShow))
			{
				c.Visible = false;
			}

			// if the control has not been added to the content panel, add it now
			if (!this.Controls.Contains(toShow))
			{
				toShow.Dock = DockStyle.Fill;
				this.Controls.Add(toShow);
			}

			toShow.Visible = true;

			// HACK: for some reason the error provider symbols don't show up the first time the control is shown
			// therefore we need to force it
			if (toShow is ApplicationComponentUserControl)
			{
				(toShow as ApplicationComponentUserControl).ErrorProvider.UpdateBinding();
			}
		}

46. Example

View license
private void UpdateParent(Control parentControl)
        {
            // Is there a change in the c/n ..... /n //View Source file for more details /n }

47. Example

View license
private void UpdateParent(Control parentControl)
        {
            // Is there a change in the c/n ..... /n //View Source file for more details /n }

48. Example

View license
private void UpdateParent(Control parentControl)
        {
            // Is there a change in the g/n ..... /n //View Source file for more details /n }

49. Example

View license
private void UpdateParent(Control parentControl)
        {
            // Is there a change in the m/n ..... /n //View Source file for more details /n }

50. Example

View license
private void UpdateParent(Control parentControl)
        {
            // Is there a change in the r/n ..... /n //View Source file for more details /n }