- Работа с формами
- Основы форм
- Введение в Windows Forms
- Создание графического приложения
- Запуск приложения
- Программирование в .NET Framework
- Приложения Windows Forms
- Некоторые полезные классы из пространства имен System.Windows.Forms
- Работа с примерами программ Windows Forms в Visual C# Express
- System. Windows. Forms. Integration Пространство имен
- Классы
- Делегаты
- Комментарии
- Form Class
- Definition
- Examples
- Remarks
- Constructors
- Fields
- Properties
- Methods
Работа с формами
Основы форм
Внешний вид приложения является нам преимущественно через формы. Формы являются основными строительными блоками. Они предоставляют контейнер для различных элементов управления. А механизм событий позволяет элементам формы отзываться на ввод пользователя, и, таким образом, взаимодействовать с пользователем.
При открытии проекта в Visual Studio в графическом редакторе мы можем увидеть визуальную часть формы — ту часть, которую мы видим после запуска приложения и куда мы переносим элементы с панели управления. Но на самом деле форма скрывает мощный функционал, состоящий из методов, свойств, событий и прочее. Рассмотрим основные свойства форм.
Если мы запустим приложение, то нам отобразится одна пустая форма. Однако даже такой простой проект с пустой формой имеет несколько компонентов:
Несмотря на то, что мы видим только форму, но стартовой точкой входа в графическое приложение является класс Program, расположенный в файле Program.cs:
Сначала программой запускается данный класс, затем с помощью выражения Application.Run(new Form1()) он запускает форму Form1. Если вдруг мы захотим изменить стартовую форму в приложении на какую-нибудь другую, то нам надо изменить в этом выражении Form1 на соответствующий класс формы.
Сама форма сложна по содержанию. Она делится на ряд компонентов. Так, в структуре проекта есть файл Form1.Designer.cs, который выглядит примерно так:
Здесь объявляется частичный класс формы Form1, которая имеет два метода: Dispose() , который выполняет роль деструктора объекта, и InitializeComponent() , который устанавливает начальные значения свойств формы.
При добавлении элементов управления, например, кнопок, их описание также добавляется в этот файл.
Но на практике мы редко будем сталкиваться с этим классом, так как они выполняет в основном дизайнерские функции — установка свойств объектов, установка переменных.
Еще один файл — Form1.resx — хранит ресурсы формы. Как правило, ресурсы используются для создания однообразных форм сразу для нескольких языковых культур.
И более важный файл — Form1.cs, который в структуре проекта называется просто Form1, содержит код или программную логику формы:
Введение в Windows Forms
Для создания графических интерфейсов с помощью платформы .NET применяются разные технологии — Window Forms, WPF, приложения для магазина Windows Store (для ОС Windows 8/8.1/10). Однако наиболее простой и удобной платформой до сих пор остается Window Forms или формы. Данное руководство ставит своей целью дать понимание принципов создания графических интерфейсов с помощью технологии WinForms и работы основных элементов управления.
Создание графического приложения
Для создания графического проекта нам потребуется среда разработки Visual Studio. Поскольку наиболее распространенная пока версия Visual Studio 2013, то для данного руководства я буду использовать бесплатную версию данной среды Visual Studio Community 2013 которую можно найти на странице https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx.
После установки среды и всех ее компонентов, запустим Visual Studio и создадим проект графического приложения. Для этого в меню выберем пункт File (Файл) и в подменю выберем New — > Project (Создать — > Проект). После этого перед нами откроется диалоговое окно создания нового проекта:
В левой колонке выберем Windows Desktop , а в центральной части среди типов проектов — тип Windows Forms Application и дадим ему какое-нибудь имя в поле внизу. Например, назовем его HelloApp. После этого нажимаем OK.
После этого Visual Studio откроет наш проект с созданными по умолчанию файлами:
Большую часть пространства Visual Studio занимает графический дизайнер, который содержит форму будущего приложения. Пока она пуста и имеет только заголовок Form1. Справа находится окно файлов решения/проекта — Solution Explorer (Обозреватель решений). Там и находятся все связанные с нашим приложением файлы, в том числе файлы формы Form1.cs.
Внизу справа находится окно свойств — Properties. Так как у меня в данный момент выбрана форма как элемент управления, то в этом поле отображаются свойства, связанные с формой.
Теперь найдем в этом окне свойство формы Text и изменим его значение на любое другое:
Таким образом мы поменяли заголовок формы. Теперь перенесем на поле какой-нибудь элемент управления, например, кнопку. Для этого найдем в левой части Visual Studio вкладку Toolbox (Панель инструментов) . Нажмем на эту вкладку, и у нас откроется панель с элементами, откуда мы можем с помощью мыши перенести на форму любой элемент:
Найдем среди элементов кнопку и, захватив ее указателем мыши, перенесем на форму:
Это визуальная часть. Теперь приступим к самому программированию. Добавим простейший код на языке C#, который бы выводил сообщение по нажатию кнопки. Для этого мы должны перейти в файл кода, который связан с этой формой. Если у нас не открыт файл кода, мы можем нажать на форму правой кнопкой мыши и в появившемся меню выбрать View Code (Посмотреть файл кода):
Однако воспользуемся другим способом, чтобы не писать много лишнего кода. Наведем указатель мыши на кнопку и щелкнем по ней двойным щелчком. Мы автоматически попадаем в файл кода Form1.cs, который выглядит так:
Добавим вывод сообщения по нажатию кнопки, изменив код следующим образом:
Запуск приложения
Чтобы запустить приложение в режиме отладки, нажмем на клавишу F5 или на зеленую стрелочку на панели Visual Studio. После этого запустится наша форма с одинокой кнопкой. И если мы нажмем на кнопку на форме, то нам будет отображено сообщение с приветствием.
После запуска приложения студия компилирует его в файл с расширением exe. Найти данный файл можно, зайдя в папку проекта и далее в каталог bin/Debug или bin/Release
Рассмотрев вкратце создание проекта графического приложения, мы можем перейти к обзору основных компонентов и начнем мы с форм.
Программирование в .NET Framework
Приложения Windows Forms
Если вы захотите писать программы, похожие на привычные приложения Windows, то наверняка воспользуетесь классами из пространства имен System.Windows.Forms . Они позволяют задействовать кнопки, списки, текстовые поля, меню, окна сообщений и множество других «элементов управления». Элементы управления — это то, что вы помещаете в форму. Они нужны для вывода информации, например, текстовой (элемент управления Label ) или графической (элемент управления PictureBox ), либо для выполнения определенных действий, например, выбора значения или перехода к другой форме после нажатия кнопки. Все элементы управления помещаются на форму.
Понятие «форма», принятое в программировании, родственно понятию «форма анкеты» или «форма документа» из обычной жизни. На форме можно в определенном порядке расположить различные элементы (текст , картинки, поля для заполнения и т. д.). Когда нам дают готовую форму документа и просят ее заполнить, мы обычно читаем содержащуюся в ней типовую информацию, а затем вписываем недостающие данные в определенные строки.
В программировании понятие формы во многом похоже: форма позволяет размещать текст, изображения, поля ввода, кнопки и т. п., добиваясь их точного расположения на экране. В консольном приложении на экран выводятся только строки текста.
Компания Майкрософт предоставила в составе библиотеки классов .NET Framework огромное количество «элементов управления», которые можно помещать на формы. Освоив этот инструмент, вы сможете быстро создавать эффектные приложения.
Некоторые полезные классы из пространства имен System.Windows.Forms
Вот некоторые элементы управления, которые можно размещать на формах:
- Label (Надпись).
- Button (Кнопка).
- ListBox (Список).
- CheckBox (Флажок).
- RadioButton (Переключатель).
- MessageBox (Окно сообщений).
- Menu (Меню).
- TabControl (Управление вкладками).
- Toolbar (Панель инструментов).
- TreeView (Дерево).
- DataGrid (Сетка данных).
- PictureBox (Изображение).
- RichTextBox (Текстовое поле с поддержкой формата RTF ).
Работа с примерами программ Windows Forms в Visual C# Express
Возможно, вы предпочтете не использовать уже заготовленные примеры проектов, а разрабатывать их «с нуля». В таком случае нужно учесть, что для каждого проекта C# Express сразу же создает два файла (с именами Form1.cs и Program.cs ) и наполняет их исходным кодом на языке C#, то есть вы изначально получаете простейшую, но полноценную программу. Предлагаемый нами способ работы с уже полученным проектом состоит в выполнении следующих действий:
- Удалите файл Form1.cs.
- Замените код в файле Program.cs на код примера, с которым вы работаете.
Оба этих действия не понадобятся, если вы открываете программы с помощью команды «Открыть проект» в меню «Файл» и находите нужный проект в той папке, куда его поместили после разархивации.
Пример программы 3.3
Рассмотрим пример простейшего приложения Windows Forms. Оно всего лишь создает новую форму и выводит определенный текст в заголовок окна формы.
Пример программы 3.4
Следующий пример тоже достаточно прост, но мы делаем шаг вперед — размещаем на форме кнопку.
Пример программы 3.5
Кнопку на форму мы поместили, но при нажатии на нее ничего не происходит. Это скучно.
Нам нужно описать метод, который будет выполнять какое-либо действие при нажатии на кнопку. Пусть при этом текст в заголовке окна будет меняться. Поскольку такой метод отслеживает наступление некоторого события (в нашем случае – нажатие на кнопку) и затем каким-то образом обрабатывает его, он, напомним, называется «обработчик события». Кроме того, надо привязать обработчик события к соответствующему событию, то есть к нажатию на кнопку.
Пример программы 3.6
Мы добились успеха: наша программа умеет выполнять основные действия. Теперь добавим на форму несколько новых элементов управления, аккуратно разместим их и немного поработаем с ними. Возьмем элементы управления 4-х типов: Button, ListBox, MessageBox и PictureBox.
System. Windows. Forms. Integration Пространство имен
Содержит классы, предназначенные для поддержки взаимодействия элементов управления Windows Forms и WPF. Contains classes that support interoperation of Windows Forms and WPF controls.
Классы
Предоставляет данные для событий ChildChanged и ChildChanged . Provides data for the ChildChanged and ChildChanged events.
Элемент управления Windows Forms, который может использоваться для размещения элемента Windows Presentation Foundation (WPF). A Windows Forms control that can be used to host a Windows Presentation Foundation (WPF) element.
Предоставляет базовый класс для классов EventArgs, поддерживающих необязательный выброс исключений. Provides a base class for EventArgs classes which support optionally raising exceptions.
Предоставляет данные для события LayoutError. Provides data for the LayoutError event.
Предоставляет способ преобразования значений свойств между элементами Windows Forms controls и Windows Presentation Foundation (WPF). Provides a way to translate property values between Windows Forms controls and Windows Presentation Foundation (WPF) elements.
Предоставляет данные для события PropertyMappingError. Provides data for the PropertyMappingError event.
Элемент, который позволяет размещать элемент управления Windows Forms на странице WPF. An element that allows you to host a Windows Forms control on a WPF page.
Делегаты
Предоставляет функцию преобразования для сопоставляемого свойства родительского элемента управления. Provides a translation function for a mapped property of the host control.
Комментарии
System.Windows.Forms.IntegrationПространство имен содержит классы, обеспечивающие взаимодействие между Windows Forms и технологиями WPF. The System.Windows.Forms.Integration namespace contains classes that enable interoperation between the Windows Forms and WPF technologies. При использовании System.Windows.Forms.Integration классов можно размещать элементы управления Windows Forms на страницах WPF, а элементы WPF — в приложениях на основе Windows Forms. When you use System.Windows.Forms.Integration classes, you can host Windows Forms controls on WPF pages, and WPF elements in Windows Forms-based applications.
Двумя ключевыми классами, реализующими возможности взаимодействия, являются WindowsFormsHost и ElementHost . The two key classes that implement interoperation capabilities are WindowsFormsHost and ElementHost. Используемый класс зависит от реализации элемента управления: Which class you use depends on your control implementation:
Используйте WindowsFormsHost класс, если необходимо использовать элемент управления Windows Forms на странице WPF. Use the WindowsFormsHost class when you must use a Windows Forms control on a WPF page.
Используйте ElementHost класс, если необходимо использовать элемент WPF в приложении на основе Windows Forms. Use the ElementHost class when you must use a WPF element in a Windows Forms-based application.
Form Class
Definition
Represents a window or dialog box that makes up an application’s user interface.
Examples
The following example creates a new instance of a Form and calls the ShowDialog method to display the form as a dialog box. The example sets the FormBorderStyle, AcceptButton, CancelButton, MinimizeBox, MaximizeBox, and StartPosition properties to change the appearance and functionality of the form to a dialog box. The example also uses the Add method of the form’s Controls collection to add two Button controls. The example uses the HelpButton property to display a help button in the caption bar of the dialog box.
Remarks
A Form is a representation of any window displayed in your application. The Form class can be used to create standard, tool, borderless, and floating windows. You can also use the Form class to create modal windows such as a dialog box. A special kind of form, the multiple-document interface (MDI) form, can contain other forms called MDI child forms. An MDI form is created by setting the IsMdiContainer property to true . MDI child forms are created by setting the MdiParent property to the MDI parent form that will contain the child form.
Using the properties available in the Form class, you can determine the appearance, size, color, and window management features of the window or dialog box you are creating. The Text property allows you to specify the caption of the window in the title bar. The Size and DesktopLocation properties allow you to define the size and position of the window when it is displayed. You can use the ForeColor color property to change the default foreground color of all controls placed on the form. The FormBorderStyle, MinimizeBox, and MaximizeBox properties allow you to control whether the form can be minimized, maximized, or resized at run time.
In addition to properties, you can use the methods of the class to manipulate a form. For example, you can use the ShowDialog method to show a form as a modal dialog box. You can use the SetDesktopLocation method to position the form on the desktop.
The events of the Form class allow you to respond to actions performed on the form. You can use the Activated event to perform operations such as updating the data displayed in the controls of the form when the form is activated.
You can use a form as the starting class in your application by placing a method called Main in the class. In the Main method add code to create and show the form. You will also need to add the STAThread attribute to the Main method in order for the form to run. When the starting form is closed, the application is also closed.
If you set the Enabled property to false before the Form is visible (for example, setting Enabled to false in the Microsoft Visual Studio designer), the minimize, maximize, close, and system buttons remain enabled. If you set Enabled to false after the Form is visible (for example, when the Load event occurs), the buttons are disabled.
Constructors
Initializes a new instance of the Form class.
Fields
Determines the value of the AutoScroll property.
(Inherited from ScrollableControl)
Determines whether the user has enabled full window drag.
(Inherited from ScrollableControl)
Determines whether the value of the HScroll property is set to true .
(Inherited from ScrollableControl)
Determines whether the user had scrolled through the ScrollableControl control.
(Inherited from ScrollableControl)
Determines whether the value of the VScroll property is set to true .
(Inherited from ScrollableControl)
Properties
Gets or sets the button on the form that is clicked when the user presses the ENTER key.
Gets the AccessibleObject assigned to the control.
(Inherited from Control)
Gets or sets the default action description of the control for use by accessibility client applications.
(Inherited from Control)
Gets or sets the description of the control used by accessibility client applications.
(Inherited from Control)
Gets or sets the name of the control used by accessibility client applications.
(Inherited from Control)
Gets or sets the accessible role of the control.
(Inherited from Control)
Gets or sets the active control on the container control.
(Inherited from ContainerControl)
Gets the currently active form for this application.
Gets the currently active multiple-document interface (MDI) child window.
Gets or sets a value indicating whether the control can accept data that the user drags onto it.
(Inherited from Control)
Gets or sets a value indicating whether the opacity of the form can be adjusted.
Gets or sets the edges of the container to which a control is bound and determines how a control is resized with its parent.
(Inherited from Control)
Gets or sets a value indicating whether the form adjusts its size to fit the height of the font used on the form and scales its controls.
Gets or sets the base size used for autoscaling of the form.
Gets or sets the dimensions that the control was designed to.
(Inherited from ContainerControl)
Gets the scaling factor between the current and design-time automatic scaling dimensions.
(Inherited from ContainerControl)
Gets or sets the automatic scaling mode of the control.
(Inherited from ContainerControl)
Gets or sets a value indicating whether the form enables autoscrolling.
Gets or sets the size of the auto-scroll margin.
(Inherited from ScrollableControl)
Gets or sets the minimum size of the auto-scroll.
(Inherited from ScrollableControl)
Gets or sets where this control is scrolled to in ScrollControlIntoView(Control).
(Inherited from Control)
Gets or sets the location of the auto-scroll position.
(Inherited from ScrollableControl)
Resize the form according to the setting of AutoSizeMode.
This property is not relevant for this class.
(Inherited from Control)
Gets or sets the mode by which the form automatically resizes itself.
Gets or sets a value that indicates whether controls in this container will be automatically validated when the focus changes.
Gets or sets a value that indicates whether controls in this container will be automatically validated when the focus changes.
(Inherited from ContainerControl)
Gets or sets the background color for the control.
Gets or sets the background image displayed in the control.
(Inherited from Control)
Gets or sets the background image layout as defined in the ImageLayout enumeration.
(Inherited from Control)
Gets or sets the BindingContext for the control.
(Inherited from ContainerControl)
Gets the distance, in pixels, between the bottom edge of the control and the top edge of its container’s client area.
(Inherited from Control)
Gets or sets the size and location of the control including its nonclient elements, in pixels, relative to the parent control.
(Inherited from Control)
Gets or sets the button control that is clicked when the user presses the ESC key.
Gets a value indicating whether the ImeMode property can be set to an active value, to enable IME support.
(Inherited from ContainerControl)
Gets a value indicating whether the control can receive focus.
(Inherited from Control)
Determines if events can be raised on the control.
(Inherited from Control)
Gets a value indicating whether the control can be selected.
(Inherited from Control)
Gets or sets a value indicating whether the control has captured the mouse.
(Inherited from Control)
Gets or sets a value indicating whether the control causes validation to be performed on any controls that require validation when it receives focus.
(Inherited from Control)
Gets the rectangle that represents the client area of the control.
(Inherited from Control)
Gets or sets the size of the client area of the form.
Gets the name of the company or creator of the application containing the control.
(Inherited from Control)
Gets the IContainer that contains the Component.
(Inherited from Component)
Gets a value indicating whether the control, or one of its child controls, currently has the input focus.
(Inherited from Control)
Gets or sets the shortcut menu associated with the control.
(Inherited from Control)
Gets or sets the ContextMenuStrip associated with this control.
(Inherited from Control)
Gets or sets a value indicating whether a control box is displayed in the caption bar of the form.
Gets the collection of controls contained within the control.
(Inherited from Control)
Gets a value indicating whether the control has been created.
(Inherited from Control)
Gets the required creation parameters when the control handle is created.
Gets the current run-time dimensions of the screen.
(Inherited from ContainerControl)
Gets or sets the cursor that is displayed when the mouse pointer is over the control.
(Inherited from Control)
Gets the data bindings for the control.
(Inherited from Control)
Gets or sets the default cursor for the control.
(Inherited from Control)
Gets the default Input Method Editor (IME) mode supported by the control.
Gets the space, in pixels, that is specified by default between controls.
(Inherited from Control)
Gets the length and height, in pixels, that is specified as the default maximum size of a control.
(Inherited from Control)
Gets the length and height, in pixels, that is specified as the default minimum size of a control.
(Inherited from Control)
Gets the internal spacing, in pixels, of the contents of a control.
(Inherited from Control)
Gets the default size of the control.
Gets a value that indicates whether the Component is currently in design mode.
(Inherited from Component)
Gets or sets the size and location of the form on the Windows desktop.
Gets or sets the location of the form on the Windows desktop.
Gets the DPI value for the display device where the control is currently being displayed.
(Inherited from Control)
Gets or sets the dialog result for the form.
Gets the rectangle that represents the virtual display area of the control.
(Inherited from ScrollableControl)
Gets a value indicating whether the base Control class is in the process of disposing.
(Inherited from Control)
Gets or sets which control borders are docked to its parent control and determines how a control is resized with its parent.
(Inherited from Control)
Gets the dock padding settings for all edges of the control.
(Inherited from ScrollableControl)
Gets or sets a value indicating whether this control should redraw its surface using a secondary buffer to reduce or prevent flicker.
(Inherited from Control)
Gets or sets a value indicating whether the control can respond to user interaction.
(Inherited from Control)
Gets the list of event handlers that are attached to this Component.
(Inherited from Component)
Gets a value indicating whether the control has input focus.
(Inherited from Control)
Gets or sets the font of the text displayed by the control.
(Inherited from Control)
Gets or sets the height of the font of the control.
(Inherited from Control)
Gets or sets the foreground color of the control.
(Inherited from Control)
Gets or sets the border style of the form.
Gets the window handle that the control is bound to.
(Inherited from Control)
Gets a value indicating whether the control contains one or more child controls.
(Inherited from Control)
Gets or sets the height of the control.
(Inherited from Control)
Gets or sets a value indicating whether a Help button should be displayed in the caption box of the form.
Gets the characteristics associated with the horizontal scroll bar.
(Inherited from ScrollableControl)
Gets or sets a value indicating whether the horizontal scroll bar is visible.
(Inherited from ScrollableControl)
Gets or sets the icon for the form.
Gets or sets the Input Method Editor (IME) mode of the control.
(Inherited from Control)
Gets or sets the IME mode of a control.
(Inherited from Control)
Gets a value indicating whether the caller must call an invoke method when making method calls to the control because the caller is on a different thread than the one the control was created on.
(Inherited from Control)
Gets or sets a value indicating whether the control is visible to accessibility applications.
(Inherited from Control)
Gets a value indicating whether the control has been disposed of.
(Inherited from Control)
Gets a value indicating whether the control has a handle associated with it.
(Inherited from Control)
Gets a value indicating whether the form is a multiple-document interface (MDI) child form.
Gets or sets a value indicating whether the form is a container for multiple-document interface (MDI) child forms.
Gets a value indicating whether the control is mirrored.
(Inherited from Control)
Gets a value indicating whether the form can use all windows and user input events without restriction.
Gets or sets a value indicating whether the form will receive key events before the event is passed to the control that has focus.
Gets a cached instance of the control’s layout engine.
(Inherited from Control)
Gets or sets the distance, in pixels, between the left edge of the control and the left edge of its container’s client area.
(Inherited from Control)
Gets or sets the Point that represents the upper-left corner of the Form in screen coordinates.
Gets or sets the coordinates of the upper-left corner of the control relative to the upper-left corner of its container.
(Inherited from Control)
Gets or sets the primary menu container for the form.
Gets or sets the space between controls.
Gets or sets the space between controls.
(Inherited from Control)
Gets or sets a value indicating whether the Maximize button is displayed in the caption bar of the form.
Gets or sets the size of the form when it is maximized.
Gets the maximum size the form can be resized to.
Gets an array of forms that represent the multiple-document interface (MDI) child forms that are parented to this form.
Gets or sets the current multiple-document interface (MDI) parent form of this form.
Gets or sets the MainMenu that is displayed in the form.
Gets the merged menu for the form.
Gets or sets a value indicating whether the Minimize button is displayed in the caption bar of the form.
Gets or sets the minimum size the form can be resized to.
Gets a value indicating whether this form is displayed modally.
Gets or sets the name of the control.
(Inherited from Control)
Gets or sets the opacity level of the form.
Gets an array of Form objects that represent all forms that are owned by this form.
Gets or sets the form that owns this form.
Gets or sets padding within the control.
(Inherited from Control)
Gets or sets the parent container of the control.
(Inherited from Control)
Gets the form that the container control is assigned to.
(Inherited from ContainerControl)
Gets the size of a rectangular area into which the control can fit.
(Inherited from Control)
Gets the product name of the assembly containing the control.
(Inherited from Control)
Gets the version of the assembly containing the control.
(Inherited from Control)
Gets a value indicating whether the control is currently re-creating its handle.
(Inherited from Control)
Gets or sets the window region associated with the control.
(Inherited from Control)
This property is now obsolete.
(Inherited from Control)
Gets or sets a value indicating whether the control redraws itself when resized.
(Inherited from Control)
Gets the location and size of the form in its normal window state.
Gets the distance, in pixels, between the right edge of the control and the left edge of its container’s client area.
(Inherited from Control)
Gets or sets a value indicating whether control’s elements are aligned to support locales using right-to-left fonts.
(Inherited from Control)
Gets or sets a value indicating whether right-to-left mirror placement is turned on.
Gets a value that determines the scaling of child controls.
(Inherited from Control)
Gets a value indicating whether the control should display focus rectangles.
(Inherited from Control)
Gets or sets a value indicating whether an icon is displayed in the caption bar of the form.
Gets or sets a value indicating whether the form is displayed in the Windows taskbar.
Gets a value indicating whether the user interface is in the appropriate state to show or hide keyboard accelerators.
(Inherited from Control)
Gets a value indicating whether the window will be activated when it is shown.
Gets or sets the site of the control.
(Inherited from Control)
Gets or sets the size of the form.
Gets or sets the style of the size grip to display in the lower-right corner of the form.
Gets or sets the starting position of the form at run time.
Gets or sets the tab order of the control within its container.
Gets or sets a value indicating whether the user can give the focus to this control using the TAB key.
Gets or sets a value indicating whether the user can give the focus to this control using the TAB key.
(Inherited from Control)
Gets or sets the object that contains data about the control.
(Inherited from Control)
Gets or sets the text associated with this control.
Gets or sets the text associated with this control.
(Inherited from Control)
Gets or sets the distance, in pixels, between the top edge of the control and the top edge of its container’s client area.
(Inherited from Control)
Gets or sets a value indicating whether to display the form as a top-level window.
Gets the parent control that is not parented by another Windows Forms control. Typically, this is the outermost Form that the control is contained in.
(Inherited from Control)
Gets or sets a value indicating whether the form should be displayed as a topmost form.
Gets or sets the color that will represent transparent areas of the form.
Gets or sets a value indicating whether to use the wait cursor for the current control and all child controls.
(Inherited from Control)
Gets the characteristics associated with the vertical scroll bar.
(Inherited from ScrollableControl)
Gets or sets a value indicating whether the control and all its child controls are displayed.
(Inherited from Control)
Gets or sets a value indicating whether the vertical scroll bar is visible.
(Inherited from ScrollableControl)
Gets or sets the width of the control.
(Inherited from Control)
Gets or sets a value that indicates whether form is minimized, maximized, or normal.
This property is not relevant for this class.
(Inherited from Control)
Methods
Notifies the accessibility client applications of the specified AccessibleEvents for the specified child control.
(Inherited from Control)
Notifies the accessibility client applications of the specified AccessibleEvents for the specified child control .
(Inherited from Control)
Activates the form and gives it focus.
Activates the MDI child of a form.
Adds an owned form to this form.
Adjusts the scroll bars on the container based on the current control positions and the control currently selected.
Resizes the form according to the current value of the AutoScaleBaseSize property and the size of the current font.
Executes the specified delegate asynchronously on the thread that the control’s underlying handle was created on.
(Inherited from Control)
Executes the specified delegate asynchronously with the specified arguments, on the thread that the control’s underlying handle was created on.
(Inherited from Control)
Brings the control to the front of the z-order.
(Inherited from Control)
Centers the position of the form within the bounds of the parent form.
Centers the form on the current screen.
Closes the form.
Retrieves a value indicating whether the specified control is a child of the control.
(Inherited from Control)
Creates a new accessibility object for the Form control.
Creates a new accessibility object for the control.
(Inherited from Control)
Forces the creation of the visible control, including the creation of the handle and any visible child controls.
(Inherited from Control)
Creates a new instance of the control collection for the control.
Creates the Graphics for the control.
(Inherited from Control)
Creates the handle for the form. If a derived class overrides this function, it must call the base implementation.
Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
(Inherited from MarshalByRefObject)
Sends the specified message to the default window procedure.
Destroys the handle associated with the control.
(Inherited from Control)
Releases all resources used by the Component.
(Inherited from Component)
Disposes of the resources (other than memory) used by the Form.
Begins a drag-and-drop operation.
(Inherited from Control)
Supports rendering to the specified bitmap.
(Inherited from Control)
Retrieves the return value of the asynchronous operation represented by the IAsyncResult passed.
(Inherited from Control)
Determines whether the specified object is equal to the current object.
(Inherited from Object)
Retrieves the form that the control is on.
(Inherited from Control)
Sets input focus to the control.
(Inherited from Control)
Retrieves the specified AccessibleObject.
(Inherited from Control)
Gets the size when autoscaling the form based on a specified font.
Retrieves a value indicating how a control will behave when its AutoSize property is enabled.
(Inherited from Control)
Retrieves the child control that is located at the specified coordinates.
(Inherited from Control)
Retrieves the child control that is located at the specified coordinates, specifying whether to ignore child controls of a certain type.
(Inherited from Control)
Returns the next ContainerControl up the control’s chain of parent controls.
(Inherited from Control)
Serves as the default hash function.
(Inherited from Object)
Retrieves the current lifetime service object that controls the lifetime policy for this instance.
(Inherited from MarshalByRefObject)
Retrieves the next control forward or back in the tab order of child controls.
(Inherited from Control)
Retrieves the size of a rectangular area into which a control can be fitted.
(Inherited from Control)
Retrieves the bounds within which the control is scaled.
Retrieves the bounds within which the control is scaled.
(Inherited from Control)
Determines whether the specified flag has been set.
(Inherited from ScrollableControl)
Returns an object that represents a service provided by the Component or by its Container.
(Inherited from Component)
Retrieves the value of the specified control style bit for the control.
(Inherited from Control)
Determines if the control is a top-level control.
(Inherited from Control)
Gets the Type of the current instance.
(Inherited from Object)
Conceals the control from the user.
(Inherited from Control)
Obtains a lifetime service object to control the lifetime policy for this instance.
(Inherited from MarshalByRefObject)
Called after the control has been added to another container.
(Inherited from Control)
Invalidates the entire surface of the control and causes the control to be redrawn.
(Inherited from Control)
Invalidates a specific region of the control and causes a paint message to be sent to the control. Optionally, invalidates the child controls assigned to the control.
(Inherited from Control)
Invalidates the specified region of the control (adds it to the control’s update region, which is the area that will be repainted at the next paint operation), and causes a paint message to be sent to the control.
(Inherited from Control)
Invalidates the specified region of the control (adds it to the control’s update region, which is the area that will be repainted at the next paint operation), and causes a paint message to be sent to the control. Optionally, invalidates the child controls assigned to the control.
(Inherited from Control)
Invalidates the specified region of the control (adds it to the control’s update region, which is the area that will be repainted at the next paint operation), and causes a paint message to be sent to the control.
(Inherited from Control)
Invalidates the specified region of the control (adds it to the control’s update region, which is the area that will be repainted at the next paint operation), and causes a paint message to be sent to the control. Optionally, invalidates the child controls assigned to the control.
(Inherited from Control)
Executes the specified delegate on the thread that owns the control’s underlying window handle.
(Inherited from Control)
Executes the specified delegate, on the thread that owns the control’s underlying window handle, with the specified list of arguments.
(Inherited from Control)
Raises the GotFocus event for the specified control.
(Inherited from Control)
Raises the LostFocus event for the specified control.
(Inherited from Control)
Raises the Click event for the specified control.
(Inherited from Control)
Raises the Paint event for the specified control.
(Inherited from Control)
Raises the PaintBackground event for the specified control.
(Inherited from Control)
Determines if a character is an input character that the control recognizes.
(Inherited from Control)
Determines whether the specified key is a regular input key or a special key that requires preprocessing.
(Inherited from Control)
Arranges the multiple-document interface (MDI) child forms within the MDI parent form.
Converts a Logical DPI value to its equivalent DeviceUnit DPI value.
(Inherited from Control)
Transforms a size from logical to device units by scaling it for the current DPI and rounding down to the nearest integer value for width and height.
(Inherited from Control)
Creates a shallow copy of the current Object.
(Inherited from Object)
Creates a shallow copy of the current MarshalByRefObject object.
(Inherited from MarshalByRefObject)
Raises the Invalidated event with a specified region of the control to invalidate.