- Control Конструкторы
- Определение
- Перегрузки
- Control()
- Комментарии
- Применяется к
- Control(String)
- Параметры
- Комментарии
- Применяется к
- Control(Control, String)
- Параметры
- Комментарии
- Применяется к
- Control(String, Int32, Int32, Int32, Int32)
- Параметры
- Комментарии
- Применяется к
- Control(Control, String, Int32, Int32, Int32, Int32)
- Параметры
- Комментарии
- Control. Controls Свойство
- Определение
- Значение свойства
- Примеры
- Комментарии
- Form. Control Collection Класс
- Определение
- Примеры
- Комментарии
- Конструкторы
- Свойства
- Методы
- Явные реализации интерфейса
- Методы расширения
Control Конструкторы
Определение
Инициализирует новый экземпляр класса Control. Initializes a new instance of the Control class.
Перегрузки
Инициализирует новый экземпляр класса Control со значениями по умолчанию. Initializes a new instance of the Control class with default settings.
Инициализирует новый экземпляр класса Control с конкретным текстом. Initializes a new instance of the Control class with specific text.
Инициализирует новый экземпляр класса Control как дочерний элемент управления с конкретным текстом. Initializes a new instance of the Control class as a child control, with specific text.
Инициализирует новый экземпляр класса Control с конкретным текстом, размером и расположением. Initializes a new instance of the Control class with specific text, size, and location.
Инициализирует новый экземпляр класса Control как дочерний элемент управления с определенным текстом, размером и местоположением. Initializes a new instance of the Control class as a child control, with specific text, size, and location.
Control()
Инициализирует новый экземпляр класса Control со значениями по умолчанию. Initializes a new instance of the Control class with default settings.
Комментарии
ControlКласс является базовым классом для всех элементов управления, используемых в Windows Forms приложении. The Control class is the base class for all controls used in a Windows Forms application. Поскольку этот класс обычно не используется для создания экземпляра класса, этот конструктор обычно не вызывается напрямую, а вызывается производным классом. Because this class is not typically used to create an instance of the class, this constructor is typically not called directly but is instead called by a derived class.
Применяется к
Control(String)
Инициализирует новый экземпляр класса Control с конкретным текстом. Initializes a new instance of the Control class with specific text.
Параметры
Текст, отображаемый элементом управления. The text displayed by the control.
Комментарии
ControlКласс является базовым классом для всех элементов управления, используемых в Windows Forms приложении. The Control class is the base class for all controls used in a Windows Forms application. Поскольку этот класс обычно не используется для создания экземпляра класса, этот конструктор обычно не вызывается напрямую, а вызывается производным классом. Because this class is not typically used to create an instance of the class, this constructor is typically not called directly but is instead called by a derived class.
Эта версия Control конструктора задает начальное Text значение свойства для text значения параметра. This version of the Control constructor sets the initial Text property value to the text parameter value.
Применяется к
Control(Control, String)
Инициализирует новый экземпляр класса Control как дочерний элемент управления с конкретным текстом. Initializes a new instance of the Control class as a child control, with specific text.
Параметры
Объект Control, который будет родительским по отношению к элементу управления. The Control to be the parent of the control.
Текст, отображаемый элементом управления. The text displayed by the control.
Комментарии
ControlКласс является базовым классом для всех элементов управления, используемых в Windows Forms приложении. The Control class is the base class for all controls used in a Windows Forms application. Поскольку этот класс обычно не используется для создания экземпляра класса, этот конструктор обычно не вызывается напрямую, а вызывается производным классом. Because this class is not typically used to create an instance of the class, this constructor is typically not called directly but is instead called by a derived class.
Эта версия Control конструктора задает начальное Text значение свойства для text значения параметра. This version of the Control constructor sets the initial Text property value to the text parameter value. Конструктор также добавляет элемент управления в родительский элемент управления Control.ControlCollection . The constructor also adds the control to the parent control’s Control.ControlCollection.
Применяется к
Control(String, Int32, Int32, Int32, Int32)
Инициализирует новый экземпляр класса Control с конкретным текстом, размером и расположением. Initializes a new instance of the Control class with specific text, size, and location.
Параметры
Текст, отображаемый элементом управления. The text displayed by the control.
Позиция X элемента управления относительно левого края контейнера элемента управления (в пикселях). The X position of the control, in pixels, from the left edge of the control’s container. Значение присваивается свойству Left. The value is assigned to the Left property.
Позиция Y элемента управления относительно верхнего края контейнера элемента управления (в пикселях). The Y position of the control, in pixels, from the top edge of the control’s container. Значение присваивается свойству Top. The value is assigned to the Top property.
Ширина элемента управления (в пикселях). The width of the control, in pixels. Значение присваивается свойству Width. The value is assigned to the Width property.
Высота элемента управления (в пикселях). The height of the control, in pixels. Значение присваивается свойству Height. The value is assigned to the Height property.
Комментарии
ControlКласс является базовым классом для всех элементов управления, используемых в Windows Forms приложении. The Control class is the base class for all controls used in a Windows Forms application. Поскольку этот класс обычно не используется для создания экземпляра класса, этот конструктор обычно не вызывается напрямую, а вызывается производным классом. Because this class is not typically used to create an instance of the class, this constructor is typically not called directly but is instead called by a derived class.
Эта версия Control конструктора задает начальное Text значение свойства для text значения параметра. This version of the Control constructor sets the initial Text property value to the text parameter value. Начальная Size и Location для элемента управления определяются left top width height значениями параметров, и. The initial Size and Location of the control are determined by the left , top , width and height parameter values.
Чтобы обеспечить лучшую производительность, не устанавливайте размер элемента управления в конструкторе. To maintain better performance, do not set the size of a control in its constructor. Предпочтительным методом является переопределение DefaultSize Свойства. The preferred method is to override the DefaultSize property.
Применяется к
Control(Control, String, Int32, Int32, Int32, Int32)
Инициализирует новый экземпляр класса Control как дочерний элемент управления с определенным текстом, размером и местоположением. Initializes a new instance of the Control class as a child control, with specific text, size, and location.
Параметры
Объект Control, который будет родительским по отношению к элементу управления. The Control to be the parent of the control.
Текст, отображаемый элементом управления. The text displayed by the control.
Позиция X элемента управления относительно левого края контейнера элемента управления (в пикселях). The X position of the control, in pixels, from the left edge of the control’s container. Значение присваивается свойству Left. The value is assigned to the Left property.
Позиция Y элемента управления относительно верхнего края контейнера элемента управления (в пикселях). The Y position of the control, in pixels, from the top edge of the control’s container. Значение присваивается свойству Top. The value is assigned to the Top property.
Ширина элемента управления (в пикселях). The width of the control, in pixels. Значение присваивается свойству Width. The value is assigned to the Width property.
Высота элемента управления (в пикселях). The height of the control, in pixels. Значение присваивается свойству Height. The value is assigned to the Height property.
Комментарии
ControlКласс является базовым классом для всех элементов управления, используемых в Windows Forms приложении. The Control class is the base class for all controls used in a Windows Forms application. Поскольку этот класс обычно не используется для создания экземпляра класса, этот конструктор обычно не вызывается напрямую, а вызывается производным классом. Because this class is not typically used to create an instance of the class, this constructor is typically not called directly but is instead called by a derived class.
Эта версия Control конструктора задает начальное Text значение свойства для text значения параметра. This version of the Control constructor sets the initial Text property value to the text parameter value. Конструктор также добавляет элемент управления в родительский элемент управления Control.ControlCollection . The constructor also adds the control to the parent control’s Control.ControlCollection. Начальная Size и Location для элемента управления определяются left top width height значениями параметров, и. The initial Size and Location of the control are determined by the left , top , width and height parameter values.
Чтобы обеспечить лучшую производительность, не устанавливайте размер элемента управления в конструкторе. To maintain better performance, do not set the size of a control in its constructor. Предпочтительным методом является переопределение DefaultSize Свойства. The preferred method is to override the DefaultSize property.
Control. Controls Свойство
Определение
Возвращает коллекцию элементов управления, содержащихся в элементе управления. Gets the collection of controls contained within the control.
Значение свойства
Объект Control.ControlCollection представляет коллекцию элементов управления, содержащихся в элементе управления. A Control.ControlCollection representing the collection of controls contained within the control.
Примеры
В следующем примере кода удаляется Control из Control.ControlCollection производного класса, Panel если он является членом коллекции. The following code example removes a Control from the Control.ControlCollection of the derived class Panel if it is a member of the collection. В этом примере необходимо создать, Panel Button и хотя бы один RadioButton элемент управления в Form . The example requires that you have created a Panel, a Button, and at least one RadioButton control on a Form. RadioButtonЭлементы управления добавляются в Panel элемент управления, а Panel элемент управления добавляется в Form . The RadioButton control(s) are added to the Panel control, and the Panel control added to the Form. При нажатии кнопки переключатель removeButton удаляется из Control.ControlCollection . When the button is clicked, the radio button named removeButton is removed from the Control.ControlCollection.
Комментарии
ControlМожет действовать как родительская коллекция элементов управления. A Control can act as a parent to a collection of controls. Например, при добавлении нескольких элементов управления в Form каждый из элементов управления является членом объекта, Control.ControlCollection присвоенного Controls свойству формы, который является производным от Control класса. For example, when several controls are added to a Form, each of the controls is a member of the Control.ControlCollection assigned to the Controls property of the form, which is derived from the Control class.
Управлять элементами управления в Control.ControlCollection назначенном Controls свойстве можно с помощью методов, доступных в Control.ControlCollection классе. You can manipulate the controls in the Control.ControlCollection assigned to the Controls property by using the methods available in the Control.ControlCollection class.
При добавлении нескольких элементов управления в родительский элемент управления рекомендуется вызывать SuspendLayout метод перед инициализацией добавляемых элементов управления. When adding several controls to a parent control, it is recommended that you call the SuspendLayout method before initializing the controls to be added. После добавления элементов управления в родительский элемент управления вызовите ResumeLayout метод. After adding the controls to the parent control, call the ResumeLayout method. Это повысит производительность приложений с большим количеством элементов управления. Doing so will increase the performance of applications with many controls.
Используйте Controls свойство для прохода по всем элементам управления формы, включая вложенные элементы управления. Use the Controls property to iterate through all controls of a form, including nested controls. Используйте GetNextControl метод для получения предыдущего или следующего дочернего элемента управления в последовательности табуляции. Use the GetNextControl method to retrieve the previous or next child control in the tab order. Используйте ActiveControl свойство, чтобы получить или задать активный элемент управления контейнера. Use the ActiveControl property to get or set the active control of a container control.
Form. Control Collection Класс
Определение
Представляет коллекцию элементов управления в форме. Represents a collection of controls on the form.
Примеры
Следующий пример кода добавляет TextBox Label элемент управления и в коллекцию элементов управления формы. The following code example adds a TextBox and Label control to the control collection of a form. Для этого примера требуется, чтобы была создана и именована форма Form1 . The example requires that a form has been created and named Form1 .
Комментарии
Этот класс представляет коллекцию элементов управления, содержащихся в форме. This class represents the collection of controls contained within a form. С помощью метода можно Add Добавить в форму элемент управления и Remove метод для удаления элемента управления из формы. You can use the Add method to add a control to the form and the Remove method to remove the control from the form. Коллекцию элементов управления, представленную этим классом, нельзя создать, не привязывая ее к определенной форме. The control collection represented by this class cannot be created without binding it to a specific form. В результате нельзя создать несколько экземпляров этой коллекции элементов управления и заменять их активной формой для предоставления различных макетов элементов управления. As a result, you cannot create multiple instances of this control collection and interchange them with an active form to provide different control layouts.
Конструкторы
Инициализирует новый экземпляр класса Form.ControlCollection. Initializes a new instance of the Form.ControlCollection class.
Свойства
Возвращает количество элементов, содержащихся в коллекции. Gets the number of elements contained in the collection.
(Унаследовано от Control.ControlCollection)
Получает значение, указывающее, является ли этот объект коллекции доступным только для чтения. Gets a value that indicates whether this collection object is read-only.
(Унаследовано от Control.ControlCollection)
Указывает объект Control, находящийся в заданном индексом местоположении в коллекции. Indicates the Control at the specified indexed location in the collection.
(Унаследовано от Control.ControlCollection)
Указывает объект Control с заданным ключом в коллекции. Indicates a Control with the specified key in the collection.
(Унаследовано от Control.ControlCollection)
Получает элемент управления, владеющий данной коллекцией Control.ControlCollection. Gets the control that owns this Control.ControlCollection.
(Унаследовано от Control.ControlCollection)
Методы
Добавляет элемент управления в форму. Adds a control to the form.
Добавляет массив объектов управления в коллекцию. Adds an array of control objects to the collection.
(Унаследовано от Control.ControlCollection)
Удаляет все элементы управления из коллекции. Removes all controls from the collection.
(Унаследовано от Control.ControlCollection)
Определяет, является ли указанный элемент управления членом коллекции. Determines whether the specified control is a member of the collection.
(Унаследовано от Control.ControlCollection)
Определяет, содержится ли элемент с указанным ключом в коллекции Control.ControlCollection. Determines whether the Control.ControlCollection contains an item with the specified key.
(Унаследовано от Control.ControlCollection)
Копирует элементы из коллекции в массив, начиная с определенного индекса массива. Copies the elements of the collection to an array, starting at a particular array index.
(Унаследовано от Control.ControlCollection)
Указывает, равен ли текущий объект коллекции указанному объекту. Specifies whether the current collection object and the specified object are equal.
(Унаследовано от Control.ControlCollection)
Выполняет поиск элементов управления по их свойству Name и создает массив из всех элементов управления, которые соответствуют условиям поиска. Searches for controls by their Name property and builds an array of all the controls that match.
(Унаследовано от Control.ControlCollection)
Извлекает индекс указанного дочернего элемента управления в коллекции элементов управления. Retrieves the index of the specified child control within the control collection.
(Унаследовано от Control.ControlCollection)
Извлекает индекс указанного дочернего элемента управления в коллекции и при необходимости вызывает исключение, если указанный элемент управления не обнаружен в коллекции элементов управления. Retrieves the index of the specified child control within the control collection, and optionally raises an exception if the specified control is not within the control collection.
(Унаследовано от Control.ControlCollection)
Извлекает ссылку на объект перечислителя, который используется для итерации по коллекции Control.ControlCollection. Retrieves a reference to an enumerator object that is used to iterate over a Control.ControlCollection.
(Унаследовано от Control.ControlCollection)
Возвращает хэш-код данного экземпляра. Returns the hash code for this instance.
(Унаследовано от Control.ControlCollection)
Возвращает объект Type для текущего экземпляра. Gets the Type of the current instance.
(Унаследовано от Object)
Извлекает индекс указанного элемента управления в коллекции элементов управления. Retrieves the index of the specified control in the control collection.
(Унаследовано от Control.ControlCollection)
Извлекает индекс первого вхождения заданного элемента в коллекции. Retrieves the index of the first occurrence of the specified item within the collection.
(Унаследовано от Control.ControlCollection)
Создает неполную копию текущего объекта Object. Creates a shallow copy of the current Object.
(Унаследовано от Object)
Удаляет элемент управления из формы. Removes a control from the form.
Удаляет элемент управления из коллекции по указанному расположению индекса. Removes a control from the control collection at the specified indexed location.
(Унаследовано от Control.ControlCollection)
Удаляет дочерний элемент управления с указанным ключом. Removes the child control with the specified key.
(Унаследовано от Control.ControlCollection)
Задает определенное значение индексу указанного дочернего элемента управления в коллекции. Sets the index of the specified child control in the collection to the specified index value.
(Унаследовано от Control.ControlCollection)
Возвращает строку, представляющую текущий объект. Returns a string that represents the current object.
(Унаследовано от Object)
Явные реализации интерфейса
Этот API поддерживает инфраструктуру продукта и не предназначен для использования непосредственно из программного кода.
Описание этого члена см. в разделе Clone(). For a description of this member, see Clone().
(Унаследовано от Control.ControlCollection)
Описание этого элемента см. в свойстве IsSynchronized. For a description of this member, see the IsSynchronized property.
(Унаследовано от ArrangedElementCollection)
Описание этого элемента см. в свойстве SyncRoot. For a description of this member, see the SyncRoot property.
(Унаследовано от ArrangedElementCollection)
Этот API поддерживает инфраструктуру продукта и не предназначен для использования непосредственно из программного кода.
Описание этого члена см. в разделе Add(Object). For a description of this member, see Add(Object).
(Унаследовано от Control.ControlCollection)
Описание этого элемента содержится в методе Clear(). For a description of this member, see the Clear() method.
(Унаследовано от ArrangedElementCollection)
Этот API поддерживает инфраструктуру продукта и не предназначен для использования непосредственно из программного кода.
Описание этого члена см. в разделе Contains(Object). For a description of this member, see Contains(Object).
(Унаследовано от Control.ControlCollection)
Этот API поддерживает инфраструктуру продукта и не предназначен для использования непосредственно из программного кода.
Описание этого члена см. в разделе IndexOf(Object). For a description of this member, see IndexOf(Object).
(Унаследовано от Control.ControlCollection)
Этот API поддерживает инфраструктуру продукта и не предназначен для использования непосредственно из программного кода.
Описание этого члена см. в разделе Insert(Int32, Object). For a description of this member, see Insert(Int32, Object).
(Унаследовано от Control.ControlCollection)
Описание этого элемента см. в свойстве IsFixedSize. For a description of this member, see the IsFixedSize property.
(Унаследовано от ArrangedElementCollection)
Описание этого элемента см. в свойстве Item[Int32]. For a description of this member, see the Item[Int32] property.
(Унаследовано от ArrangedElementCollection)
Этот API поддерживает инфраструктуру продукта и не предназначен для использования непосредственно из программного кода.
Описание этого члена см. в разделе Remove(Object). For a description of this member, see Remove(Object).
(Унаследовано от Control.ControlCollection)
Описание этого элемента содержится в методе RemoveAt(Int32). For a description of this member, see the RemoveAt(Int32) method.
(Унаследовано от ArrangedElementCollection)
Методы расширения
Приводит элементы объекта IEnumerable к заданному типу. Casts the elements of an IEnumerable to the specified type.
Выполняет фильтрацию элементов объекта IEnumerable по заданному типу. Filters the elements of an IEnumerable based on a specified type.
Позволяет осуществлять параллельный запрос. Enables parallelization of a query.
Преобразовывает коллекцию IEnumerable в объект IQueryable. Converts an IEnumerable to an IQueryable.