System.Windows.Forms
1.0.5000.0
2.0.0.0
System.Object
The class has methods to start and stop applications and threads, and to process Windows messages, as follows:
-
starts an application message loop on the current thread and, optionally, makes a form visible.
-
or stops a message loop.
-
processes messages while your program is in a loop.
-
adds a message filter to the application message pump to monitor Windows messages.
-
lets you stop an event from being raised or perform special operations before invoking an event handler.
This class has and properties to get or set culture information for the current thread.
You cannot create an instance of this class.
Provides static methods and properties to manage an application, such as methods to start and stop an application, to process Windows messages, and properties to get information about an application. This class cannot be inherited.
Method
System.Void
Use a message filter to prevent specific events from being raised or to perform special operations for an event before it is passed to an event handler. Message filters are unique to a specific thread.
To prevent a message from being dispatched, the parameter instance that you pass to this method must override the method with the code to handle the message. The method must return false.
Adding message filters to the message pump for an application can degrade performance.
Adds a message filter to monitor Windows messages as they are routed to their destinations.
The implementation of the interface you want to install.
1.0.5000.0
2.0.0.0
Property
System.Boolean
To be added.
This property returns false if it is called from a being hosted within a Web browser. Thus, the cannot quit the .
Gets a value indicating whether the caller can quit this application.
1.0.5000.0
2.0.0.0
Event
System.EventHandler
You must attach the event handlers to the event to perform unhandled, required tasks before the application stops running. You can close files opened by this application, or dispose of objects that garbage collection did not reclaim.
Because this is a static event, you must detach any event handlers attached to this event in the event handler itself. If you do not detach these handlers, they will remain attached to the event and continue to consume memory.
Occurs when the application is about to shut down.
1.0.5000.0
2.0.0.0
Property
System.String
To be added.
If a path does not exist, one is created in the following format:
Base Path\\\
first looks to see if the assembly containing the main executable has the AssemblyInformationalVersion attribute on it. If this attribute exists, it is used for both and . If this attribute does not exist, both properties use the version of the executable file instead.
The path will be different depending on whether the Windows Forms application is deployed using ndptecclick. ndptecclick applications are stored in a per-user application cache in the C:\Documents and Settings\username directory. For more information, see Accessing Local and Remote Data in ClickOnce Applications.
Gets the path for the application data that is shared among all users.
1.0.5000.0
2.0.0.0
Property
Microsoft.Win32.RegistryKey
To be added.
If the key does not exist, it is created in the following format:
LocalMachine\Software\\\
Gets the registry key for the application data that is shared among all users.
1.0.5000.0
2.0.0.0
Property
System.String
To be added.
To be added.
Gets the company name associated with the application.
1.0.5000.0
2.0.0.0
Property
System.Globalization.CultureInfo
To be added.
To be added.
Gets or sets the culture information for the current thread.
1.0.5000.0
2.0.0.0
Property
System.Windows.Forms.InputLanguage
To be added.
To be added.
Gets or sets the current input language for the current thread.
1.0.5000.0
2.0.0.0
Method
System.Void
When you run a Windows Form, it creates the new form, which then waits for events to handle. Each time the form handles an event, it processes all the code associated with that event. All other events wait in the queue. While your code handles the event, your application does not respond. For example, the window does not repaint if another window is dragged on top.
If you call in your code, your application can handle the other events. For example, if you have a form that adds data to a and add to your code, your form repaints when another window is dragged over it. If you remove from your code, your form will not repaint until the click event handler of the button is finished executing. For more information on messaging, see User Input in Windows Forms.
Unlike Visual Basic 6.0, the method does not call the method.
Typically, you use this method in a loop to process messages.
Calling this method causes the current thread to be suspended while all waiting window messages are processed. If a message causes an event to be triggered, then other areas of your application code may execute. This can cause your application to exhibit unexpected behaviors that are difficult to debug. If you perform operations or computations that take a long time, it is often preferable to perform those operations on a new thread. For more information about asynchronous programming, see Asynchronous Programming Overview.
Processes all Windows messages currently in the message queue.
1.0.5000.0
2.0.0.0
Method
System.Void
This method enables visual styles for the application. Visual styles are the colors, fonts, and other visual elements that form an operating system theme. Controls will draw with visual styles if the control and the operating system support it. To have an effect, must be called before creating any controls in the application; typically, is the first line in the Main function. A separate manifest is not required to enable visual styles when calling .
Prior to the .NET Framework 2.0, the FlatStyle property of some controls, such as controls that derive from , had to be set to in order for the controls to be drawn with visual styles. In applications written with the .NET Framework 2.0, this is no longer necessary.
This method will have no effect for controls hosted in Internet Explorer.
Enables visual styles for the application.
1.0.5000.0
2.0.0.0
Event
2.0.0.0
System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)
System.EventHandler
Because this is a static event, you must detach your event handlers when your application is disposed, or memory leaks will result.
Occurs when the application is about to enter a modal state.
Property
System.String
To be added.
To be added.
Gets the path for the executable file that started the application, including the executable name.
1.0.5000.0
2.0.0.0
Method
System.Void
The method stops all running message loops on all threads and closes all windows of the application. This method does not necessarily force the application to exit. The method is typically called from within a message loop, and forces to return. To exit a message loop for the current thread only, call .
raises the following events and performs the associated conditional actions:
-
A event is raised for every form represented by the property. This event can be canceled by setting the property of their parameter to true.
-
If one of more of the handlers cancels the event, then returns without further action. Otherwise, a event is raised for every open form, then all running message loops and forms are closed.
The method does not raise the and events, which are obsolete as of dnprdnlong.
Informs all message pumps that they must terminate, and then closes all application windows after the messages have been processed.
1.0.5000.0
2.0.0.0
Method
2.0.0.0
System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)
System.Void
To be added.
Informs all message pumps that they must terminate, and then closes all application windows after the messages have been processed.
Returns whether any within the application cancelled the exit.
Method
System.Void
Use this method to exit the message loop of the current thread. This method causes the call to for the current thread to return. To exit the entire application, call .
Exits the message loop on the current thread and closes all windows on the thread.
1.0.5000.0
2.0.0.0
Method
2.0.0.0
System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)
System.Boolean
To be added.
To be added.
To be added.
To be added.
Event
System.EventHandler
If you have tasks that you must perform before the thread becomes idle, attach them to this event.
Because this is a static event, you must detach your event handlers when your application is disposed, or memory leaks will result.
Occurs when the application finishes processing and is about to enter the idle state.
1.0.5000.0
2.0.0.0
Event
2.0.0.0
System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)
System.EventHandler
Because this is a static event, you must detach your event handlers when your application is disposed, or memory leaks will result.
Occurs when the application is about to leave a modal state.
Property
System.String
To be added.
A local user is one whose user profile is stored on the system on which the user logged on. If a path does not exist, one is created in the following format:
Base Path\\\
A typical base path is C:\Documents and Settings\username\Local Settings\Application Data. This path will be different, however, if the Windows Forms application is deployed by using ndptecclick. ndptecclick creates its own application data directory that is isolated from all other applications. For more information, see Accessing Local and Remote Data in ClickOnce Applications.
Gets the path for the application data of a local, non-roaming user.
1.0.5000.0
2.0.0.0
Property
System.Boolean
To be added.
When hosting Windows Forms in other environments, such as unmanaged applications, this property will always return false. Use to instruct Windows Forms if the hosting environment still has an active message loop.
Gets a value indicating whether a message loop exists on this thread.
1.0.5000.0
2.0.0.0
Method
System.Threading.ApartmentState
Call this method before calling any Microsoft.Win32 method that requires OLE. first checks to see if OLE has been initialized on the current thread. If not, it initializes the thread for OLE.
Unless a thread calls OLE methods directly, you do not need to call this method.
Initializes OLE on the current thread.
One of the values.
1.0.5000.0
2.0.0.0
Method
System.Void
Call to raise an exception that will halt processing of the application.
The class has a event. You can attach an event handler to this event to do whatever custom processing you need for unhandled exceptions. If you do not attach an event handler, will execute the default behavior, which involves displaying a dialog box to inform the user that there has been an error.
only implements default exception behavior for unhandled exceptions that occur on threads owned by Windows Forms. Unhandled exceptions on other threads are handled by the event.
Raises the event.
An that represents the exception that was thrown.
1.0.5000.0
2.0.0.0
Property
System.Windows.Forms.FormCollection
To be added.
The property represents a read-only collection of forms owned by the application. This collection can be searched by index position or by the of the .
Gets a collection of open forms owned by the application.
2.0.0.0
Property
System.String
To be added.
ProductName is taken from the metadata of the assembly containing the main form of the current application. You can set it by setting inside of your assembly manifest. For more information, see Assembly Manifest.
Gets the product name associated with this application.
1.0.5000.0
2.0.0.0
Property
System.String
To be added.
Typically, a version number displays as major number.minor number.build number.private part number. You can set it explicitly by setting the assembly version within your assembly manifest. For more information, see Assembly Manifest.
first looks to see if the assembly containing the main executable has the AssemblyInformationalVersion attribute on it. If this attribute exists, it is used for both and . If this attribute does not exist, both properties use the version of the executable file instead.
Gets the product version associated with this application.
1.0.5000.0
2.0.0.0
Method
2.0.0.0
System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)
System.Void
This method is used when hosting Windows Forms in another environment, such as an unmanaged application. You should call when the hosting application enters an idle state. This enables some Windows Forms controls and components to do important background work while the user is not interacting with the application.
Raises the event in hosted scenarios.
The objects to pass to the event.
Method
2.0.0.0
System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)
System.Void
To be added.
To be added.
To be added.
Method
System.Void
You can remove a message filter when you no longer want to capture Windows messages before they are dispatched.
Removes a message filter from the message pump of the application.
The implementation of the to remove from the application.
1.0.5000.0
2.0.0.0
Property
System.Boolean
To be added.
If you are drawing a custom control, use this property to decide whether to draw the control with or without visual styles, so that its appearance is consistent with other controls in the application.
The following table shows the four conditions that must exist for to return true.
-
Condition
Description
-
The operating system supports visual styles
To verify this condition separately, use the property of the class.
-
The user has enabled visual styles in the operating system
To verify this condition separately, use the property of the class.
-
Visual styles are enabled in the application
Visual styles can be enabled in an application by calling the method or by using an application manifest that specifies that ComCtl32.dll version 6 or later will be used to draw controls.
-
Visual styles are being used to draw the client area of application windows
To verify this condition separately, use the property of the class and verify that it has the value or .
Gets a value specifying whether the current application is drawing controls with visual styles.
2.0.0.0
Method
2.0.0.0
System.Void
The most common reason for calling Restart is to start a new version of the application that you have downloaded through ndptecclick using the Update or UpdateAsync method.
Applications are restarted in the context in which they were initially run. If your application was started using a URL pointing directly to the application's main executable file, it will be restarted using the same URL. If your application is a ndptecclick application, it will be restarted using ndptecclick.
If your application was originally supplied command-line options when it first executed, will launch the application again with the same options.
Shuts down the application and starts a new instance immediately.
Method
System.Void
In a Win32-based or Windows Forms application, a message loop is a routine in code that processes user events, such as mouse clicks and keyboard strokes. Every running Windows-based application requires an active message loop, called the main message loop. When the main message loop is closed, the application exits. In Windows Forms, this loop is closed when the method is called, or when the method is called on the thread that is running the main message loop.
Most Windows Forms developers will not need to use this version of the method. You should use the overload to start an application with a main form, so that the application terminates when the main form is closed. For all other situations, use the overload, which supports supplying an object for better control over the lifetime of the application.
Begins running a standard application message loop on the current thread, without a form.
1.0.5000.0
2.0.0.0
Method
System.Void
The message loop runs until or is called or the event is raised on the context object.
Begins running a standard application message loop on the current thread, with an .
An in which the application is run.
1.0.5000.0
2.0.0.0
Method
System.Void
Typically, the main function of an application calls this method and passes to it the main window of the application.
This method adds an event handler to the parameter for the event. The event handler calls to clean up the application.
The method of the class will be called prior to the return of this method.
Begins running a standard application message loop on the current thread, and makes the specified form visible.
A that represents the form to make visible.
1.0.5000.0
2.0.0.0
Property
System.String
To be added.
To be added.
Gets or sets the format string to apply to top-level window captions when they are displayed with a warning banner.
1.0.5000.0
2.0.0.0
Method
System.Void
Certain Windows Forms controls can render their text using either the class, which is based on the ndptecgdi graphics library, or the class, which is based on the ndptecgdiplus graphics library. This change was made in the dnprdnlong because of performance and localization issues with ndptecgdiplus. Use to set the default value of the UseCompatibleTextRendering property for controls that support it.
The UseCompatibleTextRendering property is intended to provide visual compatibility between Windows Forms controls that render text using the class and net_v10_short and net_v11_short applications that perform custom text rendering using the class. In most cases, if your application is not being upgraded from net_v10_short or net_v11_short, it is recommended that you leave UseCompatibleTextRendering set to the default value of false.
The ndptecgdi based class was introduced in the dnprdnlong to improve performance, make text look better, and improve support for international fonts. In earlier versions of the dnprdnshort, the ndptecgdiplus based class was used to perform all text rendering. ndptecgdi calculates character spacing and word wrapping differently from ndptecgdiplus. In a Windows Forms application that uses the class to render text, this could cause the text for controls that use to appear different from the other text in the application. To resolve this incompatibility, you can set the UseCompatibleTextRendering property to true. To set UseCompatibleTextRendering to true for all supported controls in the application, call the method with a parameter of true.
You should never call this method if your Windows Forms code is hosted in another application, such as Internet Explorer. Only call this method in stand-alone Windows Forms applications.
Sets the application-wide default for the UseCompatibleTextRendering property defined on certain controls.
The default value to use for new controls. If true, new controls that support UseCompatibleTextRendering use the ndptecgdiplus based class for text rendering; if false, new controls use the ndptecgdi based class.
2.0.0.0
Method
2.0.0.0
System.Boolean
If an application does not respond to a suspend request within 20 seconds, Windows determines that it is in a non-responsive state, and that the application can either be put to sleep or terminated. Once an application responds to a suspend request, however, it can take whatever time it needs to clean up resources and shut down active processes.
Suspends or hibernates the system, or requests that the system be suspended or hibernated.
true if the system is being suspended, otherwise, false.
A indicating the power activity mode to which to transition.
true to force the suspended mode immediately; false to cause Windows to send a suspend request to every application.
true to disable restoring the system's power status to active on a wake event, false to enable restoring the system's power status to active on a wake event.
Method
2.0.0.0
System.Void
It is often not feasible to catch all of the exceptions thrown by Windows Forms. Using this method, you can instruct your application whether it should catch all unhandled exceptions thrown by Windows Forms components and continue operating, or whether it should expose them to the user and halt execution.
Call before you instantiate the main form of your application using the method.
To catch exceptions that occur in threads not created and owned by Windows Forms, use the event handler.
Instructs the application how to respond to unhandled exceptions.
An value describing how the application should behave if an exception is thrown without being caught.
Method
2.0.0.0
System.Void
It is often not feasible to catch all of the exceptions thrown by Windows Forms. Using this method, you can instruct your application whether it should catch all unhandled exceptions thrown by Windows Forms components and continue operating, or whether it should expose them to the user and halt execution.
Call before you instantiate the main form of your application using the method.
When is true, the thread exception mode is set. The thread exception mode overrides the application exception mode if is not set to .
When is false, the application exception mode is set. The application exception mode is used for all threads that have the mode. Setting the application exception mode does not affect the setting of the current thread.
To catch exceptions that occur in threads not created and owned by Windows Forms, use the event handler.
Instructs the application how to respond to unhandled exceptions, optionally applying thread-specific behavior.
An value describing how the application should behave if an exception is thrown without being caught.
true to set the thread exception mode; otherwise, false.
Property
System.String
To be added.
To be added.
Gets the path for the executable file that started the application, not including the executable name.
1.0.5000.0
2.0.0.0
Event
System.Threading.ThreadExceptionEventHandler
This event allows your Windows Forms application to handle otherwise unhandled exceptions that occur in Windows Forms threads. Attach your event handlers to the event to deal with these exceptions, which will leave your application in an unknown state. Where possible, exceptions should be handled by a structured exception handling block.
You can change whether this callback is used for unhandled Windows Forms thread exceptions by setting . To catch exceptions that occur in threads not created and owned by Windows Forms, use the event handler.
To guarantee that no activations of this event are missed, you must attach a handler before you call .
Because this is a static event, you must detach your event handlers when your application is disposed, or memory leaks will result.
Occurs when an untrapped thread exception is thrown.
1.0.5000.0
2.0.0.0
Event
System.EventHandler
You must attach the event handlers to the event to perform any unhandled, required tasks before the thread stops running. Close files opened by this thread, or dispose of objects that the garbage collector did not reclaim.
Because this is a static event, you must detach your event handlers when your application is disposed, or memory leaks will result.
Occurs when a thread is about to shut down. When the main thread for an application is about to be shut down, this event is raised first, followed by an event.
1.0.5000.0
2.0.0.0
Method
2.0.0.0
System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)
System.Void
To be added.
Unregisters the message loop callback made with .
Property
System.String
To be added.
If a path does not exist, one is created in the following format:
Base Path\\\
Data stored in this path is part of user profile that is enabled for roaming. A roaming user works on more than one computer in a network. The user profile for a roaming user is kept on a server on the network and is loaded onto a system when the user logs on. For a user profile to be considered for roaming, the operating system must support roaming profiles and it must be enabled.
A typical base path is C:\Documents and Settings\username\Application Data. This path will be different, however, if the Windows Forms application is deployed by using ndptecclick. ndptecclick creates its own application data directory that is isolated from all other applications. For more information, see Accessing Local and Remote Data in ClickOnce Applications.
Gets the path for the application data of a user.
1.0.5000.0
2.0.0.0
Property
Microsoft.Win32.RegistryKey
To be added.
If the key does not exist, it is created in the following format:
CurrentUser\Software\\\
Data stored in this key is part of user profile that is enabled for roaming. A roaming user works on more than one computer in a network. The user profile for a roaming user is kept on a server on the network and is loaded onto a system when the user logs on. For a user profile to be considered for roaming, the operating system must support roaming profiles and it must be enabled.
Gets the registry key for the application data of a user.
1.0.5000.0
2.0.0.0
Property
2.0.0.0
System.Boolean
To be added.
When this property is set to true, the property of all open forms in the application will be set to true. This call will not return until this property has been set on all forms. Use this property when you have a long-running operation, and want to indicate in all application forms that the operation is still processing.
Gets or sets whether the wait cursor is used for all open forms of the application.
Property
System.Windows.Forms.VisualStyles.VisualStyleState
To be added.
This property determines whether visual styles are enabled in client areas or nonclient areas of application windows. Generally, this property should be set within the main form's constructor or event handler.
Gets a value that specifies how visual styles are applied to application windows.
2.0.0.0