Control 类
参考
反馈
定义
命名空间:
System.Windows.Forms
程序集:System.Windows.Forms.dll
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
定义控件的基类,控件是带有可视化表示形式的组件。
public ref class Control : System::ComponentModel::Component, System::ComponentModel::ISynchronizeInvoke, System::Windows::Forms::IWin32Window
public ref class Control : System::ComponentModel::Component, IDisposable, System::ComponentModel::ISynchronizeInvoke, System::Windows::Forms::IBindableComponent, System::Windows::Forms::IDropTarget, System::Windows::Forms::IWin32Window
public class Control : System.ComponentModel.Component, System.ComponentModel.ISynchronizeInvoke, System.Windows.Forms.IWin32Window
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)]
[System.Runtime.InteropServices.ComVisible(true)]
public class Control : System.ComponentModel.Component, IDisposable, System.ComponentModel.ISynchronizeInvoke, System.Windows.Forms.IBindableComponent, System.Windows.Forms.IDropTarget, System.Windows.Forms.IWin32Window
public class Control : System.ComponentModel.Component, IDisposable, System.ComponentModel.ISynchronizeInvoke, System.Windows.Forms.IBindableComponent, System.Windows.Forms.IDropTarget, System.Windows.Forms.IWin32Window
type Control = class
inherit Component
interface UnsafeNativeMethods.IOleControl
interface UnsafeNativeMethods.IOleObject
interface UnsafeNativeMethods.IOleInPlaceObject
interface UnsafeNativeMethods.IOleInPlaceActiveObject
interface UnsafeNativeMethods.IOleWindow
interface UnsafeNativeMethods.IViewObject
interface UnsafeNativeMethods.IViewObject2
interface UnsafeNativeMethods.IPersist
interface UnsafeNativeMethods.IPersistStreamInit
interface UnsafeNativeMethods.IPersistPropertyBag
interface UnsafeNativeMethods.IPersistStorage
interface UnsafeNativeMethods.IQuickActivate
interface ISynchronizeInvoke
interface IWin32Window
[
[
type Control = class
inherit Component
interface UnsafeNativeMethods.IOleControl
interface UnsafeNativeMethods.IOleObject
interface UnsafeNativeMethods.IOleInPlaceObject
interface UnsafeNativeMethods.IOleInPlaceActiveObject
interface UnsafeNativeMethods.IOleWindow
interface UnsafeNativeMethods.IViewObject
interface UnsafeNativeMethods.IViewObject2
interface UnsafeNativeMethods.IPersist
interface UnsafeNativeMethods.IPersistStreamInit
interface UnsafeNativeMethods.IPersistPropertyBag
interface UnsafeNativeMethods.IPersistStorage
interface UnsafeNativeMethods.IQuickActivate
interface IDropTarget
interface ISynchronizeInvoke
interface IWin32Window
interface IBindableComponent
interface IComponent
interface IDisposable
[
[
type Control = class
inherit Component
interface IDropTarget
interface ISynchronizeInvoke
interface IWin32Window
interface IBindableComponent
interface IComponent
interface IDisposable
[
[
type Control = class
inherit Component
interface IDropTarget
interface ISynchronizeInvoke
interface IWin32Window
interface IComponent
interface IDisposable
interface IBindableComponent
[
[
type Control = class
inherit Component
interface UnsafeNativeMethods.IOleControl
interface UnsafeNativeMethods.IOleObject
interface UnsafeNativeMethods.IOleInPlaceObject
interface UnsafeNativeMethods.IOleInPlaceActiveObject
interface UnsafeNativeMethods.IOleWindow
interface UnsafeNativeMethods.IViewObject
interface UnsafeNativeMethods.IViewObject2
interface UnsafeNativeMethods.IPersist
interface Interop.Ole32.IPersistStreamInit
interface UnsafeNativeMethods.IPersistPropertyBag
interface Interop.Ole32.IPersistStorage
interface UnsafeNativeMethods.IQuickActivate
interface IDropTarget
interface ISynchronizeInvoke
interface IWin32Window
interface IComponent
interface IDisposable
interface IBindableComponent
type Control = class
inherit Component
interface Interop.Ole32.IOleControl
interface Interop.Ole32.IOleObject
interface Interop.Ole32.IOleInPlaceObject
interface Interop.Ole32.IOleInPlaceActiveObject
interface Interop.Ole32.IOleWindow
interface Interop.Ole32.IViewObject
interface Interop.Ole32.IViewObject2
interface Interop.Ole32.IPersist
interface Interop.Ole32.IPersistStreamInit
interface Interop.Oleaut32.IPersistPropertyBag
interface Interop.Ole32.IPersistStorage
interface Interop.Ole32.IQuickActivate
interface IDropTarget
interface ISynchronizeInvoke
interface IWin32Window
interface IComponent
interface IDisposable
interface IBindableComponent
type Control = class
inherit Component
interface IDropTarget
interface ISynchronizeInvoke
interface IWin32Window
interface IComponent
interface IDisposable
interface IBindableComponent
interface IOleControl.Interface
interface IOleObject.Interface
interface IOleInPlaceObject.Interface
interface IOleWindow.Interface
interface IOleInPlaceActiveObject.Interface
interface IViewObject.Interface
interface IViewObject2.Interface
interface IPersist.Interface
interface IPersistStreamInit.Interface
interface IPersistPropertyBag.Interface
interface IPersistStorage.Interface
interface IQuickActivate.Interface
type Control = class
inherit Component
interface IOleControl.Interface
interface IOleObject.Interface
interface IOleInPlaceObject.Interface
interface IOleWindow.Interface
interface IOleInPlaceActiveObject.Interface
interface IViewObject.Interface
interface IViewObject2.Interface
interface IPersist.Interface
interface IPersistStreamInit.Interface
interface IPersistPropertyBag.Interface
interface IPersistStorage.Interface
interface IQuickActivate.Interface
interface IDropTarget
interface ISynchronizeInvoke
interface IWin32Window
interface IComponent
interface IDisposable
interface IBindableComponent
Public Class Control
Inherits Component
Implements ISynchronizeInvoke, IWin32Window
Public Class Control
Inherits Component
Implements IBindableComponent, IDisposable, IDropTarget, ISynchronizeInvoke, IWin32Window
继承
Object
MarshalByRefObject
Component
Control
派生
System.ComponentModel.Design.ByteViewer
System.Windows.Forms.AxHost
System.Windows.Forms.ButtonBase
System.Windows.Forms.DataGrid
System.Windows.Forms.DataGridView
System.Windows.Forms.DataVisualization.Charting.Chart
System.Windows.Forms.DateTimePicker
System.Windows.Forms.GroupBox
System.Windows.Forms.Integration.ElementHost
System.Windows.Forms.Label
System.Windows.Forms.ListControl
System.Windows.Forms.ListView
System.Windows.Forms.MdiClient
System.Windows.Forms.MonthCalendar
System.Windows.Forms.PictureBox
System.Windows.Forms.PrintPreviewControl
System.Windows.Forms.ProgressBar
System.Windows.Forms.ScrollableControl
System.Windows.Forms.ScrollBar
System.Windows.Forms.Splitter
System.Windows.Forms.StatusBar
System.Windows.Forms.TabControl
System.Windows.Forms.TextBoxBase
System.Windows.Forms.ToolBar
System.Windows.Forms.TrackBar
System.Windows.Forms.TreeView
System.Windows.Forms.WebBrowserBase
更多…
属性
ClassInterfaceAttribute
ComVisibleAttribute
实现
ISynchronizeInvoke
IWin32Window
IComponent
IDisposable
IBindableComponent
IDropTarget
注解
若要创建自己的控件类,请从 UserControl、 Control 类或从其他 Windows 窗体提供的控件继承。 有关创作自定义控件的详细信息,请参阅 使用 .NET Framework 开发自定义 Windows 窗体控件。
类 Control 实现了向用户显示信息的类所需的非常基本的功能。 它通过键盘和指向设备处理用户输入。 它处理消息路由和安全性。 它定义控件的边界, (控件的位置和大小) ,尽管它不实现绘制。 它提供窗口句柄 (hWnd) 。
Windows 窗体控件使用环境属性,因此子控件可以像周围的环境一样显示。
环境属性是一个控件属性,如果未设置,将从父控件检索该属性。 如果控件没有 Parent,并且未设置 属性,则控件会尝试通过 Site 属性确定环境属性的值。 如果控件未进行站点化、站点不支持环境属性,或者如果未在 上 AmbientProperties设置 属性,则控件使用其自己的默认值。 通常,环境属性表示与子控件通信的控件的特征,例如 BackColor。 例如,Button默认情况下,将具有与其父级Form相同的 BackColor 。 类提供Control的环境属性包括:Cursor、、Font、BackColorForeColor、 和 RightToLeft。
注意
若要使 Windows 窗体应用程序支持视觉样式,请确保将 属性System设置为 FlatStyle ,并在可执行文件中包含清单。 清单是一个 XML 文件,它作为资源包含在应用程序可执行文件中,或作为与可执行文件驻留在同一目录中的单独文件。 有关清单的示例,请参阅枚举的“示例” FlatStyle 部分。 有关使用视觉样式的详细信息,请参阅 视觉样式。
Windows 窗体内置辅助功能支持,并提供有关应用程序的信息,使它能够使用辅助功能客户端应用程序,例如屏幕放大器和审阅程序实用工具、语音输入实用工具、屏幕键盘、备用输入设备和键盘增强实用工具。 有时需要向辅助功能客户端应用程序提供其他信息。 可通过两种方式提供此附加信息。 可以设置 AccessibleName、 AccessibleDescription、 AccessibleDefaultActionDescription和 AccessibleRole 属性值,这些值将报告给辅助功能客户端应用程序。 此方法通常用于为现有控件提供有限的辅助功能信息。 或者,可以编写派生自 AccessibleObject 或 Control.ControlAccessibleObject 类的自己的类,根据需要提供尽可能多的辅助功能信息。
注意
若要保持更好的性能,请勿在其构造函数中设置控件的大小。 首选方法是重写 DefaultSize 属性。
注意
不要在其构造函数中添加 数据绑定 Control 。 这样做将导致代码生成错误,并可能导致不需要的行为。
命名空间中的 System.Windows.Forms 大多数控件都使用基础 Windows 公共控件作为基础进行构建。 有关 Windows 通用控件的详细信息,请参阅 常规控件参考。
若要从单独的进程识别 Windows 窗体控件,请使用标准 SendMessage 调用传递WM_GETCONTROLNAME消息。 WM_GETCONTROLNAME独立于语言和 Windows 层次结构。 有关详细信息,请参阅自动执行 Windows 窗体中的“适用于 Windows 窗体的建议解决方案”主题。
InvokeRequired使用 属性可同步从多个线程对 控件的访问。 有关多线程 Windows 窗体控件的详细信息,请参阅 如何:对 Windows 窗体控件进行 Thread-Safe 调用。
构造函数
Control()
使用默认设置初始化 Control 类的新实例。
Control(Control, String)
用特定文本将 Control 类的新实例初始化为子控件。
Control(Control, String, Int32, Int32, Int32, Int32)
用特定的文本、大小和位置将 Control 类的新实例初始化为子控件。
Control(String)
用特定的文本初始化 Control 类的新实例。
Control(String, Int32, Int32, Int32, Int32)
用特定的文本、大小和位置初始化 Control 类的新实例。
属性
AccessibilityObject
获取分配给该控件的 AccessibleObject。
AccessibleDefaultActionDescription
获取或设置控件的默认操作说明以供具有辅助功能的客户端应用程序使用。
AccessibleDescription
获取或设置辅助功能客户端应用程序使用的控件说明。
AccessibleName
获取或设置辅助功能客户端应用程序所使用的控件名称。
AccessibleRole
获取或设置控件的辅助性角色。
AllowDrop
获取或设置一个值,该值指示控件是否可以接受用户拖放到它上面的数据。
Anchor
获取或设置控件绑定到的容器的边缘并确定控件如何随其父级一起调整大小。
AutoScrollOffset
获取或设置一个值,该值指示在 ScrollControlIntoView(Control) 中将控件滚动到何处。
AutoSize
此属性与此类无关。
BackColor
获取或设置控件的背景色。
BackgroundImage
获取或设置在控件中显示的背景图像。
BackgroundImageLayout
获取或设置在 ImageLayout 枚举中定义的背景图像布局。
BindingContext
获取或设置控件的 BindingContext。
Bottom
获取控件下边缘与其容器的工作区上边缘之间的距离(以像素为单位)。
Bounds
获取或设置控件(包括其非工作区元素)相对于其父控件的大小和位置(以像素为单位)。
CanEnableIme
获取一个用以指示是否可以将 ImeMode 属性设置为活动值的值,以启用 IME 支持。
CanFocus
获取一个值,该值指示控件是否可以接收焦点。
CanRaiseEvents
确定是否可以在控件上引发事件。
CanRaiseEvents
获取一个指示组件是否可以引发事件的值。
(继承自 Component)
CanSelect
获取一个值,该值指示是否可以选中控件。
Capture
获取或设置一个值,该值指示控件是否已捕获鼠标。
CausesValidation
获取或设置一个值,该值指示控件是否会引起在任何需要在接收焦点时执行验证的控件上执行验证。
CheckForIllegalCrossThreadCalls
获取或设置一个值,该值指示是否捕获对错误线程的调用,这些调用在调试应用程序时访问控件的 Handle 属性。
ClientRectangle
获取表示控件的工作区的矩形。
ClientSize
获取或设置控件的工作区的高度和宽度。
CompanyName
获取包含控件的应用程序的公司名称或创建者。
Container
获取包含 IContainer 的 Component。
(继承自 Component)
ContainsFocus
获取一个值,该值指示控件或它的一个子控件当前是否有输入焦点。
ContextMenu
获取或设置与控件关联的快捷菜单。
ContextMenuStrip
获取或设置与此控件关联的 ContextMenuStrip。
Controls
获取包含在控件内的控件的集合。
Created
获取一个值,该值指示控件是否已经创建。
CreateParams
获取创建控件句柄时所需要的创建参数。
Cursor
获取或设置当鼠标指针位于控件上时显示的光标。
DataBindings
为该控件获取数据绑定。
DataContext
获取或设置用于数据绑定的数据上下文。
这是一个环境属性。
DefaultBackColor
获取控件的默认背景色。
DefaultCursor
获取或设置控件的默认光标。
DefaultFont
获取控件的默认字体。
DefaultForeColor
获取控件的默认前景色。
DefaultImeMode
获取控件支持的默认输入法编辑器 (IME) 模式。
DefaultMargin
获取控件之间默认指定的间距(以像素为单位)。
DefaultMaximumSize
获取以像素为单位的长度和高度,此长度和高度被指定为控件的默认最大大小。
DefaultMinimumSize
获取以像素为单位的长度和高度,此长度和高度被指定为控件的默认最小大小。
DefaultPadding
获取 控件内容的默认内部间距(以像素为单位)。
DefaultSize
获取控件的默认大小。
DesignMode
获取一个值,用以指示 Component 当前是否处于设计模式。
(继承自 Component)
DeviceDpi
获取显示当前控件的显示设备的 DPI 值。
DisplayRectangle
获取表示控件的显示区域的矩形。
Disposing
获取一个值,该值指示 Control 基类是否在释放进程中。
Dock
获取或设置哪些控件边框停靠到其父控件并确定控件如何随其父级一起调整大小。
DoubleBuffered
获取或设置一个值,该值指示此控件是否应使用辅助缓冲区重绘其图面,以减少或避免闪烁。
Enabled
获取或设置一个值,该值指示控件是否可以对用户交互作出响应。
Events
获取附加到此 Component 的事件处理程序的列表。
(继承自 Component)
Focused
获取一个值,该值指示控件是否有输入焦点。
Font
获取或设置控件显示的文字的字体。
FontHeight
获取或设置控件的字体的高度。
ForeColor
获取或设置控件的前景色。
Handle
获取控件绑定到的窗口句柄。
HasChildren
获取一个值,该值指示控件是否包含一个或多个子控件。
Height
获取或设置控件的高度。
ImeMode
获取或设置控件的输入法编辑器 (IME) 模式。
ImeModeBase
获取或设置控件的 IME 模式。
InvokeRequired
获取一个值,该值指示调用方在对控件进行方法调用时是否必须调用 Invoke 方法,因为调用方位于创建控件所在的线程以外的线程中。
IsAccessible
获取或设置一个值,该值指示控件对辅助功能应用程序是否可见。
IsAncestorSiteInDesignMode
指示此控件的上级之一是否位于 DesignMode 中以及该站点。 此属性为只读。
IsDisposed
获取一个值,该值指示控件是否已经被释放。
IsHandleCreated
获取一个值,该值指示控件是否有与它关联的句柄。
IsMirrored
获取一个值,该值指示此控件是否为镜像控件。
LayoutEngine
获取控件的布局引擎的缓存实例。
Left
获取或设置控件左边缘与其容器的工作区左边缘之间的距离(以像素为单位)。
Location
获取或设置该控件的左上角相对于其容器的左上角的坐标。
Margin
获取或设置控件之间的空间。
MaximumSize
获取或设置大小,该大小是 GetPreferredSize(Size) 可以指定的上限。
MinimumSize
获取或设置大小,该大小是 GetPreferredSize(Size) 可以指定的下限。
ModifierKeys
获取一个表示哪个修改键(Shift、Ctrl 和 Alt)处于按下状态的值。
MouseButtons
获取一个指示哪个鼠标按钮处于按下状态的值。
MousePosition
获取鼠标光标的位置(以屏幕坐标表示)。
Name
获取或设置控件的名称。
Padding
获取或设置控件内的空白。
Parent
获取或设置控件的父容器。
PreferredSize
获取可以容纳控件的矩形区域的大小。
ProductName
获取包含控件的程序集的产品名称。
ProductVersion
获取包含控件的程序集的版本。
PropagatingImeMode
获取一个表示传播 IME 模式的对象。
RecreatingHandle
获取一个值,该值指示控件当前是否在重新创建其句柄。
Region
获取或设置与控件关联的窗口区域。
RenderRightToLeft
已过时.
已过时.
此属性现已过时。
ResizeRedraw
获取或设置一个值,该值指示控件在调整大小时是否重绘自己。
Right
获取控件右边缘与其容器的工作区左边缘之间的距离(以像素为单位)。
RightToLeft
获取或设置一个值,该值指示是否将控件的元素对齐以支持使用从右向左的字体的区域设置。
ScaleChildren
获取一个值,该值确定子控件的缩放。
ShowFocusCues
获取一个值,该值指示控件是否应显示聚焦框。
ShowKeyboardCues
获取一个值,该值指示用户界面是否处于适当的状态以显示或隐藏键盘快捷键。
Site
获取或设置控件的站点。
Size
获取或设置控件的高度和宽度。
TabIndex
获取或设置控件在其容器内的 Tab 键顺序。
TabStop
获取或设置一个值,该值指示用户能否使用 Tab 键将焦点放到该控件上。
Tag
获取或设置包含有关控件的数据的对象。
Text
获取或设置与此控件关联的文本。
Top
获取或设置控件上边缘与其容器的工作区上边缘之间的距离(以像素为单位)。
TopLevelControl
获取没有另一个 Windows 窗体控件作为其父级的父控件。 通常,这是控件所在的最外面的 Form。
UseWaitCursor
获取或设置一个值,该值指示是否将等待光标用于当前控件以及所有子控件。
Visible
获取或设置一个值,该值指示是否显示该控件及其所有子控件。
Width
获取或设置控件的宽度。
WindowTarget
此属性与此类无关。
方法
AccessibilityNotifyClients(AccessibleEvents, Int32)
就指定子控件的指定 AccessibleEvents 通知辅助功能客户端应用程序。
AccessibilityNotifyClients(AccessibleEvents, Int32, Int32)
就指定子控件的指定 AccessibleEvents 通知辅助功能客户端应用程序。
BeginInvoke(Action)
在创建控件的基础句柄所在线程上异步执行指定委托。
BeginInvoke(Delegate)
在创建控件的基础句柄所在线程上异步执行指定委托。
BeginInvoke(Delegate, Object[])
在创建控件的基础句柄所在线程上,用指定的自变量异步执行指定委托。
BringToFront()
将控件带到 Z 顺序的前面。
Contains(Control)
检索一个值,该值指示指定控件是否为一个控件的子控件。
CreateAccessibilityInstance()
为该控件创建一个新的辅助功能对象。
CreateControl()
强制创建可见控件,包括创建句柄和任何可见子控件。
CreateControlsInstance()
为控件创建控件集合的新实例。
CreateGraphics()
为控件创建 Graphics。
CreateHandle()
为该控件创建句柄。
CreateObjRef(Type)
创建一个对象,该对象包含生成用于与远程对象进行通信的代理所需的全部相关信息。
(继承自 MarshalByRefObject)
DefWndProc(Message)
向默认窗口过程发送指定消息。
DestroyHandle()
毁坏与该控件关联的句柄。
Dispose()
释放由 Component 使用的所有资源。
(继承自 Component)
Dispose(Boolean)
释放由 Control 和它的子控件占用的非托管资源,另外还可以释放托管资源。
DoDragDrop(Object, DragDropEffects)
开始拖放操作。
DoDragDrop(Object, DragDropEffects, Bitmap, Point, Boolean)
开始拖动操作。
DrawToBitmap(Bitmap, Rectangle)
支持对指定位图的呈现。
EndInvoke(IAsyncResult)
检索由传递的 IAsyncResult 表示的异步操作的返回值。
Equals(Object)
确定指定对象是否等于当前对象。
(继承自 Object)
FindForm()
检索控件所在的窗体。
Focus()
为控件设置输入焦点。
FromChildHandle(IntPtr)
检索包含指定句柄的控件。
FromHandle(IntPtr)
返回当前与指定句柄关联的控件。
GetAccessibilityObjectById(Int32)
检索指定的 AccessibleObject。
GetAutoSizeMode()
检索一个值,该值指示当启用控件的 AutoSize 属性时控件的行为方式。
GetChildAtPoint(Point)
检索位于指定坐标处的子控件。
GetChildAtPoint(Point, GetChildAtPointSkip)
检索位于指定坐标的子控件,并且指定是否忽略特定类型的子控件。
GetContainerControl()
沿着控件的父控件链向上,返回下一个 ContainerControl。
GetHashCode()
作为默认哈希函数。
(继承自 Object)
GetLifetimeService()
已过时.
检索控制此实例的生存期策略的当前生存期服务对象。
(继承自 MarshalByRefObject)
GetNextControl(Control, Boolean)
按照子控件的 Tab 键顺序向前或向后检索下一个控件。
GetPreferredSize(Size)
检索适合控件的矩形区域的大小。
GetScaledBounds(Rectangle, SizeF, BoundsSpecified)
检索缩放控件时的边界。
GetService(Type)
返回一个对象,该对象表示由 Component 或它的 Container 提供的服务。
(继承自 Component)
GetStyle(ControlStyles)
为控件检索指定控件样式位的值。
GetTopLevel()
确定控件是否是顶级控件。
GetType()
获取当前实例的 Type。
(继承自 Object)
Hide()
对用户隐藏控件。
InitializeLifetimeService()
已过时.
获取生存期服务对象来控制此实例的生存期策略。
(继承自 MarshalByRefObject)
InitLayout()
在将控件添加到另一个容器之后调用。
Invalidate()
使控件的整个图面无效并导致重绘控件。
Invalidate(Boolean)
使控件的特定区域无效并向控件发送绘制消息。 还可以使分配给该控件的子控件无效。
Invalidate(Rectangle)
使控件的指定区域无效(将其添加到控件的更新区域,下次绘制操作时将重新绘制更新区域),并向控件发送绘制消息。
Invalidate(Rectangle, Boolean)
使控件的指定区域无效(将其添加到控件的更新区域,下次绘制操作时将重新绘制更新区域),并向控件发送绘制消息。 还可以使分配给该控件的子控件无效。
Invalidate(Region)
使控件的指定区域无效(将其添加到控件的更新区域,下次绘制操作时将重新绘制更新区域),并向控件发送绘制消息。
Invalidate(Region, Boolean)
使控件的指定区域无效(将其添加到控件的更新区域,下次绘制操作时将重新绘制更新区域),并向控件发送绘制消息。 还可以使分配给该控件的子控件无效。
Invoke(Action)
在拥有此控件的基础窗口句柄的线程上执行指定的委托。
Invoke(Delegate)
在拥有此控件的基础窗口句柄的线程上执行指定的委托。
Invoke(Delegate, Object[])
在拥有控件的基础窗口句柄的线程上,用指定的参数列表执行指定委托。
Invoke
在拥有此控件的基础窗口句柄的线程上执行指定的委托。
InvokeAsync(Action, CancellationToken)
定义控件的基类,控件是带有可视化表示形式的组件。
InvokeAsync(Func
定义控件的基类,控件是带有可视化表示形式的组件。
InvokeAsync
定义控件的基类,控件是带有可视化表示形式的组件。
InvokeAsync
定义控件的基类,控件是带有可视化表示形式的组件。
InvokeGotFocus(Control, EventArgs)
为指定的控件引发 GotFocus 事件。
InvokeLostFocus(Control, EventArgs)
为指定的控件引发 LostFocus 事件。
InvokeOnClick(Control, EventArgs)
为指定的控件引发 Click 事件。
InvokePaint(Control, PaintEventArgs)
为指定的控件引发 Paint 事件。
InvokePaintBackground(Control, PaintEventArgs)
为指定的控件引发 PaintBackground 事件。
IsInputChar(Char)
确定一个字符是否是控件可识别的输入字符。
IsInputKey(Keys)
确定指定的键是常规输入键还是需要预处理的特殊键。
IsKeyLocked(Keys)
确定 Caps Lock、Num Lock 或 Scroll Lock 键是否有效。
IsMnemonic(Char, String)
搜索指定的字符串,以确定指定字符是否是分配给此控件的助记键字符。
LogicalToDeviceUnits(Int32)
将逻辑 DPI 值转换为它的等效 DeviceUnit DPI 值。
LogicalToDeviceUnits(Size)
通过为当前 DPI 缩放小大并将其向下舍入为最接近的宽度和高度的整数值,将大小从逻辑单位转换为设备单位。
MemberwiseClone()
创建当前 Object 的浅表副本。
(继承自 Object)
MemberwiseClone(Boolean)
创建当前 MarshalByRefObject 对象的浅表副本。
(继承自 MarshalByRefObject)
NotifyInvalidate(Rectangle)
引发 Invalidated 事件,其中带有要使之无效的控件的指定区域。
OnAutoSizeChanged(EventArgs)
引发 AutoSizeChanged 事件。
OnBackColorChanged(EventArgs)
引发 BackColorChanged 事件。
OnBackgroundImageChanged(EventArgs)
引发 BackgroundImageChanged 事件。
OnBackgroundImageLayoutChanged(EventArgs)
引发 BackgroundImageLayoutChanged 事件。
OnBindingContextChanged(EventArgs)
引发 BindingContextChanged 事件。
OnCausesValidationChanged(EventArgs)
引发 CausesValidationChanged 事件。
OnChangeUICues(UICuesEventArgs)
引发 ChangeUICues 事件。
OnClick(EventArgs)
引发 Click 事件。
OnClientSizeChanged(EventArgs)
引发 ClientSizeChanged 事件。
OnContextMenuChanged(EventArgs)
引发 ContextMenuChanged 事件。
OnContextMenuStripChanged(EventArgs)
引发 ContextMenuStripChanged 事件。
OnControlAdded(ControlEventArgs)
引发 ControlAdded 事件。
OnControlRemoved(ControlEventArgs)
引发 ControlRemoved 事件。
OnCreateControl()
引发 CreateControl() 方法。
OnCursorChanged(EventArgs)
引发 CursorChanged 事件。
OnDataContextChanged(EventArgs)
定义控件的基类,控件是带有可视化表示形式的组件。
OnDockChanged(EventArgs)
引发 DockChanged 事件。
OnDoubleClick(EventArgs)
引发 DoubleClick 事件。
OnDpiChangedAfterParent(EventArgs)
引发 DpiChangedAfterParent 事件。
OnDpiChangedBeforeParent(EventArgs)
引发 DpiChangedBeforeParent 事件。
OnDragDrop(DragEventArgs)
引发 DragDrop 事件。
OnDragEnter(DragEventArgs)
引发 DragEnter 事件。
OnDragLeave(EventArgs)
引发 DragLeave 事件。
OnDragOver(DragEventArgs)
引发 DragOver 事件。
OnEnabledChanged(EventArgs)
引发 EnabledChanged 事件。
OnEnter(EventArgs)
引发 Enter 事件。
OnFontChanged(EventArgs)
引发 FontChanged 事件。
OnForeColorChanged(EventArgs)
引发 ForeColorChanged 事件。
OnGiveFeedback(GiveFeedbackEventArgs)
引发 GiveFeedback 事件。
OnGotFocus(EventArgs)
引发 GotFocus 事件。
OnHandleCreated(EventArgs)
引发 HandleCreated 事件。
OnHandleDestroyed(EventArgs)
引发 HandleDestroyed 事件。
OnHelpRequested(HelpEventArgs)
引发 HelpRequested 事件。
OnImeModeChanged(EventArgs)
引发 ImeModeChanged 事件。
OnInvalidated(InvalidateEventArgs)
引发 Invalidated 事件。
OnKeyDown(KeyEventArgs)
引发 KeyDown 事件。
OnKeyPress(KeyPressEventArgs)
引发 KeyPress 事件。
OnKeyUp(KeyEventArgs)
引发 KeyUp 事件。
OnLayout(LayoutEventArgs)
引发 Layout 事件。
OnLeave(EventArgs)
引发 Leave 事件。
OnLocationChanged(EventArgs)
引发 LocationChanged 事件。
OnLostFocus(EventArgs)
引发 LostFocus 事件。
OnMarginChanged(EventArgs)
引发 MarginChanged 事件。
OnMouseCaptureChanged(EventArgs)
引发 MouseCaptureChanged 事件。
OnMouseClick(MouseEventArgs)
引发 MouseClick 事件。
OnMouseDoubleClick(MouseEventArgs)
引发 MouseDoubleClick 事件。
OnMouseDown(MouseEventArgs)
引发 MouseDown 事件。
OnMouseEnter(EventArgs)
引发 MouseEnter 事件。
OnMouseHover(EventArgs)
引发 MouseHover 事件。
OnMouseLeave(EventArgs)
引发 MouseLeave 事件。
OnMouseMove(MouseEventArgs)
引发 MouseMove 事件。
OnMouseUp(MouseEventArgs)
引发 MouseUp 事件。
OnMouseWheel(MouseEventArgs)
引发 MouseWheel 事件。
OnMove(EventArgs)
引发 Move 事件。
OnNotifyMessage(Message)
向控件通知 Windows 消息。
OnPaddingChanged(EventArgs)
引发 PaddingChanged 事件。
OnPaint(PaintEventArgs)
引发 Paint 事件。
OnPaintBackground(PaintEventArgs)
绘制控件的背景。
OnParentBackColorChanged(EventArgs)
当控件容器的 BackColorChanged 属性值更改时,将引发 BackColor 事件。
OnParentBackgroundImageChanged(EventArgs)
当控件容器的 BackgroundImageChanged 属性值更改时,将引发 BackgroundImage 事件。
OnParentBindingContextChanged(EventArgs)
当控件容器的 BindingContextChanged 属性值更改时,将引发 BindingContext 事件。
OnParentChanged(EventArgs)
引发 ParentChanged 事件。
OnParentCursorChanged(EventArgs)
引发 CursorChanged 事件。
OnParentDataContextChanged(EventArgs)
定义控件的基类,控件是带有可视化表示形式的组件。
OnParentEnabledChanged(EventArgs)
当控件容器的 EnabledChanged 属性值更改时,将引发 Enabled 事件。
OnParentFontChanged(EventArgs)
当控件容器的 FontChanged 属性值更改时,将引发 Font 事件。
OnParentForeColorChanged(EventArgs)
当控件容器的 ForeColorChanged 属性值更改时,将引发 ForeColor 事件。
OnParentRightToLeftChanged(EventArgs)
当控件容器的 RightToLeftChanged 属性值更改时,将引发 RightToLeft 事件。
OnParentVisibleChanged(EventArgs)
当控件容器的 VisibleChanged 属性值更改时,将引发 Visible 事件。
OnPreviewKeyDown(PreviewKeyDownEventArgs)
引发 PreviewKeyDown 事件。
OnPrint(PaintEventArgs)
引发 Paint 事件。
OnQueryContinueDrag(QueryContinueDragEventArgs)
引发 QueryContinueDrag 事件。
OnRegionChanged(EventArgs)
引发 RegionChanged 事件。
OnResize(EventArgs)
引发 Resize 事件。
OnRightToLeftChanged(EventArgs)
引发 RightToLeftChanged 事件。
OnSizeChanged(EventArgs)
引发 SizeChanged 事件。
OnStyleChanged(EventArgs)
引发 StyleChanged 事件。
OnSystemColorsChanged(EventArgs)
引发 SystemColorsChanged 事件。
OnTabIndexChanged(EventArgs)
引发 TabIndexChanged 事件。
OnTabStopChanged(EventArgs)
引发 TabStopChanged 事件。
OnTextChanged(EventArgs)
引发 TextChanged 事件。
OnValidated(EventArgs)
引发 Validated 事件。
OnValidating(CancelEventArgs)
引发 Validating 事件。
OnVisibleChanged(EventArgs)
引发 VisibleChanged 事件。
PerformLayout()
强制控件将布局逻辑应用于其所有子控件。
PerformLayout(Control, String)
强制控件将布局逻辑应用于其所有子控件。
PointToClient(Point)
将指定屏幕点的位置计算成工作区坐标。
PointToScreen(Point)
将指定工作区点的位置计算成屏幕坐标。
PreProcessControlMessage(Message)
在调度键盘或输入消息之前,在消息循环内对它们进行预处理。
PreProcessMessage(Message)
在调度键盘或输入消息之前,在消息循环内对它们进行预处理。
ProcessCmdKey(Message, Keys)
处理命令键。
ProcessDialogChar(Char)
处理对话框字符。
ProcessDialogKey(Keys)
处理对话框键。
ProcessKeyEventArgs(Message)
处理键消息并生成适当的控件事件。
ProcessKeyMessage(Message)
处理键盘消息。
ProcessKeyPreview(Message)
预览键盘消息。
ProcessMnemonic(Char)
处理助记键字符。
RaiseDragEvent(Object, DragEventArgs)
引发适当的拖动事件。
RaiseKeyEvent(Object, KeyEventArgs)
引发适当的键事件。
RaiseMouseEvent(Object, MouseEventArgs)
引发适当的鼠标事件。
RaisePaintEvent(Object, PaintEventArgs)
引发适当的绘画事件。
RecreateHandle()
强制为控件重新创建句柄。
RectangleToClient(Rectangle)
计算指定屏幕矩形的大小和位置(以工作区坐标表示)。
RectangleToScreen(Rectangle)
计算指定工作区矩形的大小和位置(以屏幕坐标表示)。
ReflectMessage(IntPtr, Message)
向绑定到指定句柄的控件反映指定消息。
Refresh()
强制控件使其工作区无效并立即重绘自己和任何子控件。
RescaleConstantsForDpi(Int32, Int32)
发生 DPI 更改时,提供用于重新缩放控件的常数。
ResetBackColor()
将 BackColor 属性重置为其默认值。
ResetBindings()
使绑定到 BindingSource 的控件重新读取列表中的所有项,并刷新这些项的显示值。
ResetCursor()
将 Cursor 属性重置为其默认值。
ResetFont()
将 Font 属性重置为其默认值。
ResetForeColor()
将 ForeColor 属性重置为其默认值。
ResetImeMode()
将 ImeMode 属性重置为其默认值。
ResetMouseEventArgs()
重置控件以处理 MouseLeave 事件。
ResetRightToLeft()
将 RightToLeft 属性重置为其默认值。
ResetText()
将 Text 属性重置为其默认值 (Empty)。
ResumeLayout()
恢复正常的布局逻辑。
ResumeLayout(Boolean)
恢复正常的布局逻辑,可以选择强制对挂起的布局请求立即进行布局。
RtlTranslateAlignment(ContentAlignment)
将指定的 ContentAlignment 转换为相应的 ContentAlignment 以支持从右向左的文本。
RtlTranslateAlignment(HorizontalAlignment)
将指定的 HorizontalAlignment 转换为相应的 HorizontalAlignment 以支持从右向左的文本。
RtlTranslateAlignment(LeftRightAlignment)
将指定的 LeftRightAlignment 转换为相应的 LeftRightAlignment 以支持从右向左的文本。
RtlTranslateContent(ContentAlignment)
将指定的 ContentAlignment 转换为相应的 ContentAlignment 以支持从右向左的文本。
RtlTranslateHorizontal(HorizontalAlignment)
将指定的 HorizontalAlignment 转换为相应的 HorizontalAlignment 以支持从右向左的文本。
RtlTranslateLeftRight(LeftRightAlignment)
将指定的 LeftRightAlignment 转换为相应的 LeftRightAlignment 以支持从右向左的文本。
Scale(Single)
已过时.
已过时.
缩放控件和任何子控件。
Scale(Single, Single)
已过时.
已过时.
缩放整个控件和任何子控件。
Scale(SizeF)
按指定的比例因子缩放控件和所有子控件。
ScaleBitmapLogicalToDevice(Bitmap)
发生 DPI 更改时,可以将逻辑位图值缩放到其等效设备单元值。
ScaleControl(SizeF, BoundsSpecified)
缩放控件的位置、大小、空白和边距。
ScaleCore(Single, Single)
此方法与此类无关。
Select()
激活控件。
Select(Boolean, Boolean)
激活子控件。 还可以指定从中选择控件的 Tab 键顺序的方向。
SelectNextControl(Control, Boolean, Boolean, Boolean, Boolean)
激活下一个控件。
SendToBack()
将控件发送到 Z 顺序的后面。
SetAutoSizeMode(AutoSizeMode)
设置一个值,该值指示当启用控件的 AutoSize 属性时控件的行为方式。
SetBounds(Int32, Int32, Int32, Int32)
将控件的边界设置为指定位置和大小。
SetBounds(Int32, Int32, Int32, Int32, BoundsSpecified)
将控件的指定边界设置为指定位置和大小。
SetBoundsCore(Int32, Int32, Int32, Int32, BoundsSpecified)
执行设置该控件的指定边界的工作。
SetClientSizeCore(Int32, Int32)
设置控件的工作区的大小。
SetStyle(ControlStyles, Boolean)
将指定的 ControlStyles 标志设置为 true 或 false。
SetTopLevel(Boolean)
将控件设置为顶级控件。
SetVisibleCore(Boolean)
将控件设置为指定的可见状态。
Show()
向用户显示控件。
SizeFromClientSize(Size)
确定整个控件(从控件工作区的高度和宽度起计算)的大小。
SuspendLayout()
临时挂起控件的布局逻辑。
ToString()
返回包含 Component 的名称的 String(如果有)。 不应重写此方法。
(继承自 Component)
Update()
使控件重绘其工作区内的无效区域。
UpdateBounds()
用当前大小和位置更新控件的边界。
UpdateBounds(Int32, Int32, Int32, Int32)
用指定大小和位置更新控件的边界。
UpdateBounds(Int32, Int32, Int32, Int32, Int32, Int32)
用指定大小、位置和工作区的大小更新控件的边界。
UpdateStyles()
强制将分配的样式重新应用到控件。
UpdateZOrder()
按控件的父级的 Z 顺序更新控件。
WndProc(Message)
处理 Windows 消息。
事件
AutoSizeChanged
此事件与此类无关。
BackColorChanged
当 BackColor 属性的值更改时发生。
BackgroundImageChanged
当 BackgroundImage 属性的值更改时发生。
BackgroundImageLayoutChanged
当 BackgroundImageLayout 属性更改时发生。
BindingContextChanged
当 BindingContext 属性的值更改时发生。
CausesValidationChanged
当 CausesValidation 属性的值更改时发生。
ChangeUICues
焦点或键盘用户界面 (UI) 提示更改时发生。
Click
在单击控件时发生。
ClientSizeChanged
当 ClientSize 属性的值更改时发生。
ContextMenuChanged
当 ContextMenu 属性的值更改时发生。
ContextMenuStripChanged
当 ContextMenuStrip 属性的值更改时发生。
ControlAdded
在将新控件添加到 Control.ControlCollection 时发生。
ControlRemoved
在从 Control.ControlCollection 移除控件时发生。
CursorChanged
当 Cursor 属性的值更改时发生。
DataContextChanged
当 DataContext 属性的值更改时发生。
Disposed
在通过调用 Dispose() 方法释放组件时发生。
(继承自 Component)
DockChanged
当 Dock 属性的值更改时发生。
DoubleClick
在双击控件时发生。
DpiChangedAfterParent
当父控件或窗体的 DPI 更改后,以编程方式更改控件的 DPI 设置时发生。
DpiChangedBeforeParent
父控件或窗体的 DPI 更改事件发生前,以编程方式更改控件的 DPI 设置时发生。
DragDrop
拖放操作完成时发生。
DragEnter
在将对象拖入控件的边界时发生。
DragLeave
将对象拖出控件的边界时发生。
DragOver
在将对象拖到控件的边界上发生。
EnabledChanged
在 Enabled 属性值更改后发生。
Enter
进入控件时发生。
FontChanged
在 Font 属性值更改时发生。
ForeColorChanged
在 ForeColor 属性值更改时发生。
GiveFeedback
在执行拖动操作期间发生。
GotFocus
在控件接收焦点时发生。
HandleCreated
在为控件创建句柄时发生。
HandleDestroyed
在控件的句柄处于销毁过程中时发生。
HelpRequested
用户请求控件帮助时发生。
ImeModeChanged
在 ImeMode 属性更改后发生。
Invalidated
控件的显示要求重新绘制时发生。
KeyDown
在控件有焦点的情况下按下键时发生。
KeyPress
在控件有焦点的情况下 字符、空格或退格键时发生。
KeyUp
在控件有焦点的情况下释放键时发生。
Layout
在控件应重新定位其子控件时发生。
Leave
在输入焦点离开控件时发生。
LocationChanged
在 Location 属性值更改后发生。
LostFocus
在控件失去焦点时发生。
MarginChanged
在控件边距更改时发生。
MouseCaptureChanged
当控件失去鼠标捕获时发生。
MouseClick
用鼠标单击控件时发生。
MouseDoubleClick
用鼠标双击控件时发生。
MouseDown
当鼠标指针位于控件上并按下鼠标键时发生。
MouseEnter
在鼠标指针进入控件时发生。
MouseHover
在鼠标指针停放在控件上时发生。
MouseLeave
在鼠标指针离开控件时发生。
MouseMove
在鼠标指针移到控件上时发生。
MouseUp
在鼠标指针在控件上并释放鼠标键时发生。
MouseWheel
在控件有焦点且鼠标轮移动时发生。
Move
在移动控件时发生。
PaddingChanged
在控件空白区更改时发生。
Paint
在重绘控件时发生。
ParentChanged
在 Parent 属性值更改时发生。
PreviewKeyDown
在焦点位于此控件上的情况下,当有按键动作时发生(在 KeyDown 事件之前发生)。
QueryAccessibilityHelp
在 AccessibleObject 为辅助功能应用程序提供帮助时发生。
QueryContinueDrag
在拖放操作期间发生,并且允许拖动源确定是否应取消拖放操作。
RegionChanged
当 Region 属性的值更改时发生。
Resize
在调整控件大小时发生。
RightToLeftChanged
在 RightToLeft 属性值更改时发生。
SizeChanged
在 Size 属性值更改时发生。
StyleChanged
在控件样式更改时发生。
SystemColorsChanged
系统颜色更改时发生。
TabIndexChanged
在 TabIndex 属性值更改时发生。
TabStopChanged
在 TabStop 属性值更改时发生。
TextChanged
在 Text 属性值更改时发生。
Validated
在控件完成验证时发生。
Validating
在控件验证时发生。
VisibleChanged
在 Visible 属性值更改时发生。
显式接口实现
IDropTarget.OnDragDrop(DragEventArgs)
引发 DragDrop 事件。
IDropTarget.OnDragEnter(DragEventArgs)
引发 DragEnter 事件。
IDropTarget.OnDragLeave(EventArgs)
引发 DragLeave 事件。
IDropTarget.OnDragOver(DragEventArgs)
引发 DragOver 事件。
适用于
线程安全性
只有以下成员是线程安全的:BeginInvoke(Delegate)、EndInvoke(IAsyncResult)、Invoke(Delegate)InvokeRequired、 和CreateGraphics()(如果已创建控件的句柄)。 在后台线程上创建控件句柄之前调用 CreateGraphics() 可能会导致非法跨线程调用。
另请参阅
Form
ScrollableControl
ContainerControl
Component