473,395 Members | 1,679 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Hosting whole Form (not a UserControl) as MFC MDI dialog

CWinFormsDialog in .net 2.0 lets you host a .Net UserControl as a dialog in a
managed C++ MDI application.

I.e. in the sample:
-----------------------------------------------

#include <afxwinforms.h>
#using <WinFormUserControl1.dll>
using namespace WinFormUserControl1;

// CWinFormModeless dialog
class CWinFormModeless : public CWinFormsDialog<WinFormUserControl1Control>
{ ...}
-----------------------------------------------

Its basically a template class that lets you host any of your UserControl.

My question is, Is there any way of using a Form rather than a user control?
Is there any general way in .Net of getting from a Form to a user control?
I basically want to contain an entire form in a user control so that I can
easily add future .Net forms back into my legacy C++ MDI App.

You can show the forms without any of this bother, but when you show them
modeless, they aren't properly contained within the main app window and
dissapear behind it.
May 23 '06 #1
1 4835
Heres an update:
I've been experimenting with the new .Net 2.0 CWinFormsDialog as a way of
also including new C# Forms in our legacy Managed C++ MDI application.
Currently (in VS2003) you can show modal .Net forms without any problems,
but if you show a modeless Form it disappears behind the main frame.
CWinFormsDialog is supposed to solve these problems and let you host a user
control as if it was a normal CDialog.
In the sample
(http://www.microsoft.com/downloads/d...displaylang=en) it has some text in it as follows:

// This should be the line you use to invoke a Modeless
// CWinFormDialog
//m_pWinFormModeless->Create(CWinFormModeless::IDD);
// But because of a sizing bug you need to use a custom
// dialog template that matches the size of the hosted UserControl
m_pWinFormModeless->Create(IDD_EMPTYDIALOG);

Does anyone have any more information on exactly what the problem is and
when it will be solved?
I'm running:
Microsoft Visual Studio 2005 Team Edition Version 8.0.50727.42
(RTM.050727-4200)
Microsoft .NET Framework Version 2.0.50727
Installed Edition: Enterprise
Microsoft Visual C# 2005 77642-113-3000004-41249

I believe that I may be coming across the sizing problem.
Are there any Microsoft people reading this forum?

Their work around of having an empty dialog resource the same size as the
user control you wish to host is no good for us.
We are basically having a dummy user control that just hosts the form you
pass in to it.
If I could get this working, this would be a nice way of plugging in new
..Net stuff into our legacy applications.

"James" wrote:
CWinFormsDialog in .net 2.0 lets you host a .Net UserControl as a dialog in a
managed C++ MDI application.

I.e. in the sample:
-----------------------------------------------

#include <afxwinforms.h>
#using <WinFormUserControl1.dll>
using namespace WinFormUserControl1;

// CWinFormModeless dialog
class CWinFormModeless : public CWinFormsDialog<WinFormUserControl1Control>
{ ...}
-----------------------------------------------

Its basically a template class that lets you host any of your UserControl.

My question is, Is there any way of using a Form rather than a user control?
Is there any general way in .Net of getting from a Form to a user control?
I basically want to contain an entire form in a user control so that I can
easily add future .Net forms back into my legacy C++ MDI App.

You can show the forms without any of this bother, but when you show them
modeless, they aren't properly contained within the main app window and
dissapear behind it.

May 26 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ward Bekker | last post by:
Hi, I am researching if it is possible to incorporate the web forms designer that is used by visual studio in another application. Hosting the WIN forms designer is already possible (see...
2
by: Mystery Man | last post by:
I have developed a series of user defined controls. These have been placed on a variety of different forms. From within one of these controls, I want to show another dialog directly to the right...
1
by: Jason | last post by:
Hi I would like a user control/form that can be either called as a dialog (ShowDialog) or embedded in another form (usercontrol). preferably, my dialog/usercontrol accepts an argument that...
2
by: Robbie | last post by:
I have a Web Form with some tailored logos and artwork. The web form also has a user control that has typical registration info on it (Name, Company Name, etc.) One of the fields, a TextBox, is a...
3
by: Lloyd Sheen | last post by:
I have the following situation: Need a user resizable user control. After much trying with user control I came across the idea of hosting the controls in a form marked as not TopLevel = false. ...
2
by: **Developer** | last post by:
I have a little more info about this problem I can't seem to solve! I know it'll take a minute to study the lising but if you like to sove puzzles there is one there. I have a Form (FV&C)...
0
by: hmm | last post by:
Hi all I have two problems: Problem #1: I'm using a .NET Form with the property 'FormBorderStyle' set to 'None'. The idea is to completely cover the area of that Form with a UserControl. In...
10
by: Benton | last post by:
Hi there, I have a UserControl with a couple of textboxes and a couple of buttons ("Save" and "Cancel"). The Click event for this buttons is in the UserControl's codebehind of course, so here's...
1
by: Monty | last post by:
I have a Usercontrol with a public property List<intLinks List <intLinks= new List<int>(); public List<intLinkLabels { get { return Links; } set { Links = value; } }
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.