Windows forms properties control


















The following list describes common scenarios for developing Windows Forms controls. The base class for Windows Forms controls, System. Control , provides the plumbing required for visual display in client-side Windows applications. Control provides a window handle, handles message routing, and provides mouse and keyboard events as well as many other user interface events.

It provides advanced layout and has properties. Additionally, it provides security, threading support, and interoperability with ActiveX controls. The Windows Forms controls are listed here according to general function you can find all of these controls in the ToolBox. The Windows Forms Button control allows the user to click it to perform an action.

When the button is clicked, it looks as if it is being pushed in and released. Whenever the user clicks a button, the Click event handler is invoked. You place code in the Click event handler to perform any action you choose. The text displayed on the button is contained in the Text property. However, it will be clipped if the control cannot accommodate its overall height. The Text property can contain all. The appearance of the text is controlled by the Font property and the TextAlign property.

The Button control can also display images using the Image and ImageList properties. The most basic use of a Windows Forms Button control is to run some code when the button is clicked. If you intend to attach event handlers for these related events, be sure that their actions do not conflict.

For example, if clicking the button clears information that the user has typed in a text box, pausing the mouse pointer over the button should not display a tool tip with that now-nonexistent information. Invalidate in turn calls the OnPaint method, which redraws the control. Multiple calls to Invalidate result in a single call to OnPaint for efficiency.

NET Framework class library provides type converters for common data types such as integers, decimal numbers, Boolean values, and others. The purpose of a type converter is generally to provide string-to-value conversion from string data to other data types.

Common data types are associated with default type converters that convert values into strings and strings into the appropriate data types. If you define a property that is a custom that is, nonstandard data type, you will have to apply an attribute that specifies the type converter to associate with that property.

You can also use an attribute to associate a custom UI type editor with a property. A UI type editor provides a user interface for editing a property or data type.

Occurs when the value of the Cursor property changes. Occurs when the component is disposed by a call to the Dispose method. Occurs when the value of the Dock property changes. Occurs when the DPI setting for a control is changed programmatically after the DPI of its parent control or form has changed. Occurs when the DPI setting for a control is changed programmatically before a DPI change event for its parent control or form has occurred.

Occurs when the Enabled property value has changed. Occurs when the Font property value changes. Occurs when the ForeColor property value changes. Occurs when the ImeMode property has changed. Occurs when the Location property value has changed. Occurs when the Parent property value changes. Occurs before the KeyDown event when a key is pressed while focus is on this control. Occurs when AccessibleObject is providing help to accessibility applications.

Occurs during a drag-and-drop operation and enables the drag source to determine whether the drag-and-drop operation should be canceled.

Occurs when the value of the Region property changes. Occurs when the RightToLeft property value changes. Occurs when the Size property value changes. Occurs when the TabIndex property value changes. Occurs when the TabStop property value changes. Occurs when the Text property value changes. Occurs when the Visible property value changes. Calling CreateGraphics before the control's handle has been created on a background thread can cause illegal cross thread calls.

Skip to main content. This browser is no longer supported. Download Microsoft Edge More info. Contents Exit focus mode.

Control Class Reference Is this page helpful? Please rate your experience Yes No. Any additional feedback? Namespace: System. Forms Assembly: System. Defines the base class for controls, which are components with visual representation. Note To make your Windows Forms application support visual styles, be sure to set the FlatStyle property to System and include a manifest with your executable.

Note To maintain better performance, do not set the size of a control in its constructor. Note Do not add data bindings for a Control in its constructor. In this article. Control Control, String. Control String. Gets or sets the description of the control used by accessibility client applications. Gets or sets the name of the control used by accessibility client applications. Gets or sets a value indicating whether the control can accept data that the user drags onto it.

Gets a value indicating whether the component can raise an event. Inherited from Component. Gets or sets a value indicating whether the control has captured the mouse. Gets the name of the company or creator of the application containing the control. Gets the required creation parameters when the control handle is created.

Gets or sets the cursor that is displayed when the mouse pointer is over the control. Gets the space, in pixels, that is specified by default between controls.

Gets the DPI value for the display device where the control is currently being displayed. Gets or sets a value indicating whether the control can respond to user interaction.

Gets a value indicating whether the control contains one or more child controls. Gets or sets a value indicating whether the control is visible to accessibility applications. Gets a value indicating whether the control has a handle associated with it. Gets a value indicating which of the mouse buttons is in a pressed state. Gets a value indicating whether the control is currently re-creating its handle. This property is now obsolete. Gets or sets a value indicating whether the control redraws itself when resized.

Gets a value indicating whether the control should display focus rectangles. Gets or sets a value indicating whether the control and all its child controls are displayed.

BeginInvoke Action. BeginInvoke Delegate. BeginInvoke Delegate, Object[]. Contains Control. Retrieves a value indicating whether the specified control is a child of the control. CreateObjRef Type. Inherited from MarshalByRefObject. DefWndProc Message. Dispose Boolean. DrawToBitmap Bitmap, Rectangle.

EndInvoke IAsyncResult. Equals Object. Determines whether the specified object is equal to the current object. Inherited from Object. FromChildHandle IntPtr. FromHandle IntPtr. Returns the control that is currently associated with the specified handle.

GetChildAtPoint Point. Retrieves the child control that is located at the specified coordinates. Serves as the default hash function. GetNextControl Control, Boolean. Retrieves the next control forward or back in the tab order of child controls. GetPreferredSize Size. Retrieves the size of a rectangular area into which a control can be fitted.

GetService Type. GetStyle ControlStyles. Retrieves the value of the specified control style bit for the control. Obtains a lifetime service object to control the lifetime policy for this instance. Invalidates the entire surface of the control and causes the control to be redrawn. Invalidate Boolean. Invalidate Rectangle.

Invalidate Rectangle, Boolean. Invalidate Region. Invalidate Region, Boolean. Invoke Action. Executes the specified delegate on the thread that owns the control's underlying window handle. Invoke Delegate. Invoke Delegate, Object[]. IsInputChar Char. Determines if a character is an input character that the control recognizes.

IsInputKey Keys. IsKeyLocked Keys. The default is the value of the DefaultFont property. The Font property is an ambient property. An ambient property is a control property that, if not set, is retrieved from the parent control. For example, a Button will have the same BackColor as its parent Form by default. For more information about ambient properties, see the AmbientProperties class or the Control class overview.

Because the Font is immutable meaning that you cannot adjust any of its properties , you can only assign the Font property a new Font.



0コメント

  • 1000 / 1000