A wrapper for an MFC dialog class that hosts a Windows Forms user control.
template <typename TManagedControl> class CWinFormsDialog : public CDialog
The .NET Framework user control to be displayed in the MFC application.
|CWinFormsDialog::GetControl||Retrieves a reference to the Windows Forms user control.|
|CWinFormsDialog::GetControlHandle||Retrieves a window handle to the Windows Forms user control.|
|CWinFormsDialog::OnInitDialog||Initializes the MFC dialog box by creating and hosting a Windows Forms user control on it.|
|CWinFormsDialog::operator ->||Replaces CWinFormsDialog::GetControl in expressions.|
|CWinFormsDialog::operator TManagedControl^||Casts a type as a reference to a Windows Forms user control.|
CWinFormsDialog is a wrapper for an MFC dialog class ( CDialog) that hosts a Windows Forms user control. This allows the display of .NET Framework controls on a modal or modeless MFC dialog box.
For more information on using Windows Forms, see Using a Windows Form User Control in MFC and Hosting a Windows Form User Control as an MFC Dialog Box.
CWinFormsDialog(UINT nIDTemplate = IDD);
Contains the ID of a dialog box template resource. Use the dialog editor to create the dialog template and store it in the application's resource script file. For more information on dialog templates, see CDialog Class.
Retrieves a reference to the Windows Forms user control.
inline TManagedControl^ GetControl() const;
Returns a reference to the Windows Forms control in the MFC dialog box.
Retrieves a window handle to the Windows Forms user control.
inline HWND GetControlHandle() const throw();
Returns a window handle to the Windows Forms user control.
Initializes the MFC dialog box by creating and hosting a Windows Forms user control on it.
virtual BOOL OnInitDialog();
A Boolean value that specifies whether the application has set the input focus to one of the controls in the dialog box. If
OnInitDialog returns nonzero, Windows sets the input focus to the first control in the dialog box. This method can return 0 only if the application has explicitly set the input focus to one of the controls in the dialog box.
When the MFC dialog box is created (using the Create, CreateIndirect, or DoModal method inherited from CDialog), a WM_INITDIALOG message is sent and this method is called. It creates an instance of a Windows Forms control on the dialog box and adjusts the size of the dialog box to accommodate for the size of the user control. Then it hosts the new control in the MFC dialog box.
Override this member function if you need to perform special processing when the dialog box is initialized. For more information on using this method, see CDialog::OnInitDialog.
Replaces CWinFormsDialog::GetControl in expressions.
inline TManagedControl^ operator->() const throw();
This operator provides a convenient syntax that replaces
GetControl in expressions.
For information on using Windows Forms, see Using a Windows Form User Control in MFC.
Casts a type as a reference to a Windows Forms user control.
inline operator TManagedControl^() const throw();
This operator casts a type as a reference to a Windows Forms control. It is used to pass a
CWinFormsDialog<TManagedControl> dialog box to functions that accept a pointer to a Windows Forms user control object.
We'd love to hear your thoughts. Choose the type you'd like to provide:
Our feedback system is built on GitHub Issues. Read more on our blog.