I have a c# .net 2.0 winforms application which consists basically of one f开发者_StackOverfloworm A.
I am building another form B with a tabcontrol on it. From the form B, I would like to be able to create one or more instances of this application. Each form A I would like to be placed on tabpages on form B's tabcontrol.
Each instance is a different process that is running on a separated folder.
How could I achieve this?
Another way to put this is, how I could dock a form from another running instance into the current application instance's form.
Look at this codeproject article. It is what you are searching for.
I think the best way to do this would be to have to versions of your app. One is the executable and the other is a component that you could add dynamically. I have an app that I do this with tool controls. Each tool represents a separate set of functionality that can be added to a workspace (tab) depending on the user's need for it. For example, I have a tool for logging particular items that's called "logger" and a user can create a new instance of it which essentially adds it as a new tab in the main window. Just a thought. I think docking two running instances of the same application would have to be handled by Windows through the app docking interface.
If you don't control the source code for both of these applications then I don't think you can accomplish your objective.
If you DO control the source code, then I would recommend that you isolate the Form A functionality in a usercontrol in a separate library and reference this from the form in AppA and from the tab control in App B
精彩评论