CommonDialog Class
Specifies the base class used for displaying dialog boxes on the screen.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
System::MarshalByRefObject
System.ComponentModel::Component
System.Windows.Forms::CommonDialog
System.Windows.Forms::ColorDialog
System.Windows.Forms::FileDialog
System.Windows.Forms::FolderBrowserDialog
System.Windows.Forms::FontDialog
System.Windows.Forms::PageSetupDialog
System.Windows.Forms::PrintDialog
| Name | Description | |
|---|---|---|
![]() | CommonDialog() | Initializes a new instance of the CommonDialog class. |
| Name | Description | |
|---|---|---|
![]() | CanRaiseEvents | Gets a value indicating whether the component can raise an event.(Inherited from Component.) |
![]() | Container | Gets the IContainer that contains the Component.(Inherited from Component.) |
![]() | DesignMode | |
![]() | Events | |
![]() | Site | |
![]() | Tag | Gets or sets an object that contains data about the control. |
| Name | Description | |
|---|---|---|
![]() | CreateObjRef(Type^) | Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.(Inherited from MarshalByRefObject.) |
![]() | Dispose() | |
![]() | Dispose(Boolean) | |
![]() | Equals(Object^) | Determines whether the specified object is equal to the current object.(Inherited from Object.) |
![]() | Finalize() | |
![]() | GetHashCode() | Serves as the default hash function. (Inherited from Object.) |
![]() | GetLifetimeService() | Retrieves the current lifetime service object that controls the lifetime policy for this instance.(Inherited from MarshalByRefObject.) |
![]() | GetService(Type^) | |
![]() | GetType() | |
![]() | HookProc(IntPtr, Int32, IntPtr, IntPtr) | Defines the common dialog box hook procedure that is overridden to add specific functionality to a common dialog box. |
![]() | InitializeLifetimeService() | Obtains a lifetime service object to control the lifetime policy for this instance.(Inherited from MarshalByRefObject.) |
![]() | MemberwiseClone() | |
![]() | MemberwiseClone(Boolean) | Creates a shallow copy of the current MarshalByRefObject object.(Inherited from MarshalByRefObject.) |
![]() | OnHelpRequest(EventArgs^) | Raises the HelpRequest event. |
![]() | OwnerWndProc(IntPtr, Int32, IntPtr, IntPtr) | Defines the owner window procedure that is overridden to add specific functionality to a common dialog box. |
![]() | Reset() | When overridden in a derived class, resets the properties of a common dialog box to their default values. |
![]() | RunDialog(IntPtr) | When overridden in a derived class, specifies a common dialog box. |
![]() | ShowDialog() | Runs a common dialog box with a default owner. |
![]() | ShowDialog(IWin32Window^) | Runs a common dialog box with the specified owner. |
![]() | ToString() |
| Name | Description | |
|---|---|---|
![]() | Disposed | |
![]() | HelpRequest | Occurs when the user clicks the Help button on a common dialog box. |
Inherited classes are required to implement RunDialog by invoking ShowDialog to create a specific common dialog box. Inherited classes can optionally override HookProc to implement specific dialog box hook functionality.
The following code example uses the ColorDialog implementation of CommonDialog and illustrates creating and showing a dialog box. This example requires that the method is called from within an existing form, which has a TextBox and Button placed on it.
private: void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) { ColorDialog^ MyDialog = gcnew ColorDialog; // Keeps the user from selecting a custom color. MyDialog->AllowFullOpen = false; // Allows the user to get help. (The default is false.) MyDialog->ShowHelp = true; // Sets the initial color select to the current text color. MyDialog->Color = textBox1->ForeColor; // Update the text box color if the user clicks OK if ( MyDialog->ShowDialog() == ::System::Windows::Forms::DialogResult::OK ) { textBox1->ForeColor = MyDialog->Color; } }
Available since 1.1
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.




