2

I'm taking my first class in C# development for winforms. I'm using VS Premium 2013.

We've been working on an application all semester. For our final project one of our tasks is to convert it from an SDI to an MDI.

The mainform is structured as follows:

  1. menustrip
  2. toolstrip
  3. split panel with a treeview control in its own class, a listview control in its own class, and a rich text box in its own class (these are all then displayed on the mainform)
  4. user control that functions as a status bar docked at the bottom of the form

The code for all the click events and business logic is already written. This is already a robust application.

Is there a "best practice" for converting an SDI like this to an MDI? There's a ton of code here, and unless I get better guidance, I assume I'm going to have to create a new project, move over the classes that I can and then rewrite all the supporting event handlers and associated logic.

Is there a more time-efficient option that someone can recommend?

abatishchev
  • 98,240
  • 88
  • 296
  • 433
Diana Tortolini
  • 230
  • 1
  • 3
  • 10

1 Answers1

3

There is no single answer because the specifics of the migration depend on the specifics of your current application. If you have written it well then there should be almost no change at all. It should be mostly just setting the MdiParent of each document form before showing it. There would still be a few details to consider but that would be the bulk of.

So that changes like this are relatively painless is one of the main reasons that design patterns are used in development. Also, the less coupled the types are in your project, the easier they move around in these cases. For instance, if you have two types that each rely on the other to be exactly as they are then any change is going to have significant impact on both. If those types are decoupled though, a change in one may have absolutely no effect on the other.

jmcilhinney
  • 50,448
  • 5
  • 26
  • 46