I want to use a MDI-form as a container for forms with no border. Therefore these forms must fit in the child area of the MDI-parent (without any appearing scrollbars). How to get this size?
Printable View
I want to use a MDI-form as a container for forms with no border. Therefore these forms must fit in the child area of the MDI-parent (without any appearing scrollbars). How to get this size?
You could set their dockstyle to fill after instantiating them.
Code:Dim frm As Form
frm.MdiParent = me
frm.show()
frm.dockstyle = dockstyle.fill
It sounds to me like you should be using a regular form and UserControls rather than an MDI interface. Would you care to elaborate on the scenario?
JM, I have a similar application where I use an MDI container with a customer ToolBar. The balance of the MDI container is used to open Children without borders so the GUI looks more fluid (Just my opinion).
Well I want to encapsulate functionality in each form. Each form has a certain function.Quote:
Originally Posted by jmcilhinney
A UserControl can have a certain function just as easily as a form.Quote:
Originally Posted by namrekka
Quote:
Originally Posted by circuits2
This works, however what if I want 2 form next to each other (glued together)VB Code:
frm.Dock=DockStyle.Fill
The forms are containing to much code. I want to use the same style as I did before in VB6 app's.Quote:
Originally Posted by jmcilhinney
If forms have too much code, and you want more than one open, perhaps you need to use JM's idea and use a UserControl for each.
Forget VB6. This is VB.NET and it's not the same thing. If the situation is best served by UserControls then UserControls is what you should use. Of course, you can do whatever you want but doing something because its what you did in VB6 is just plain illogical. Why did you switch to VB.NET if you want to do things the VB6 way? You changed, I would imagine, because VB.NET offered advantages, but if you insist on doing things the way you used to then you're ignoring some of those advantages. If VB.NET offers a better way to do something then I'd suggest that you use it. For instance, two UserControls in a TableLayoutPanel will give you the side-by-side thing and maintain the relative dimensions even if the form is resized. With forms you'd have to do a lot more of the work manually. Fight progress if you want but I don't see the point.Quote:
Originally Posted by namrekka
Sorry jmcilhinney but what I mean with "the same style as I did before in VB6 app's" is how it looks like for the user.
What I mean with "The forms are containing to much code" is that they contain to much code for using it in a control and I don't want to reuse.
If you used forms (or a UserControl), what would you be putting in it/them? How many different forms/UserControls do you have to choose from? Could you get away with using panels?
The current app I talk about had a total 40k lines of code divided over 45 forms and a ca 50 classes. This a app in VB6. Now a "sort of the same" application needs to be created in VS2005. I, and others, did like the appearance of the other application and for the new one I like to use the same style.
Panels can be used. But can't encapsulate data. Perhaps I have to think it over.Quote:
Could you get away with using panels?
If you used forms before, then the easiest conversion or duplication is going to be using forms again. Especially when your application depends on events inside the forms. On the flip side, you still didn't answer the question of what is on the forms. Therefore, your answer to that question may lead you right back the JM's suggestion of using UserControls.
From a child form, you can get its mdiparent clientsize. Use this info to set your child form's width and height.Quote:
Originally Posted by namrekka
VB Code:
MsgBox(Me.MdiParent.ClientSize.ToString)
Thanks this info works!Quote:
Originally Posted by stanav
I don't see the reason to tell what is on the 45 forms. I told that forms are not used for reuse but only for encapsulating functionality. Each form is different from the other. 1 form for video capture. 1 form for interact and measuring the image, 1 form with profiles, etc. So what is the advantage of using a usercontrol then?Quote:
Originally Posted by circuits2