Click here to Skip to main content
15,889,216 members
Everything / MDI

MDI

MDI

Great Reads

by Darryl Bryk
Code is described for drawing an image as a 3D surface plot using OpenGL
by Robert Gustafson
Simplifies working with ToolStrip-type menus and tool bars for MDI-parent and other forms; also works with ToolStrip-type context menus
by snavece
Updating CToolBar to MFC Feature Pack (2008)

Latest Articles

by Robert Gustafson
Simplifies working with ToolStrip-type menus and tool bars for MDI-parent and other forms; also works with ToolStrip-type context menus
by snavece
Updating CToolBar to MFC Feature Pack (2008)
by Darryl Bryk
Code is described for drawing an image as a 3D surface plot using OpenGL

All Articles

Sort by Score

MDI 

19 Feb 2011 by Sergey Alexandrovich Kryukov
Technically speaking, Answers by Espen and Nishant are correct.But do yourself a favor, listen to my good friendly advice: don't do MDI!There are not so many UI designs that are so inconvenient and cumbersome! Everyone I know (and I know very many computer people, not just developers) hate...
19 Feb 2011 by Espen Harlinn
Another very good solution on codeplex is AvalonDock[^] - You'll be able to create a flexible UI similar to the Visual Studio tabbed MDI.RegardsEspen Harlinn
17 Mar 2011 by Espen Harlinn
Charles,I'...
10 Jul 2011 by Espen Harlinn
Try playing around with WPF - it has better support for nesting windows inside windows, nested inside windows - and so on ...There are also nice libraries like AvalonDock[^] that will help you manage the UI. SAKryukov do have a point - to much of this may easily confuse users ...Best...
18 Feb 2016 by Richard Deeming
Use an Interface[^].Walkthrough: Creating and Implementing Interfaces (Visual Basic)[^]Public Interface ISaveableForm Sub SaveNow()End Interface...Private Sub SaveToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles...
20 Feb 2011 by Abhinav S
I agree with SA. Trying using dashboard like controls (tab, docks etc).They allow you to show much more data on the same page.
27 Mar 2011 by Brijesh Kr
I think you are using like follow:At an event of a control of MDI use follow: child ch=new child(); ch.MdiParent = this; ch.Show();First you should have a Form, enable it's IsMdiContainer=true.child is a normal form.
25 May 2011 by Sergey Alexandrovich Kryukov
Yes of course. You can even compile some project during run-time and add compiled assemblies. And right, it can be done using interfaces.Actually, "compiled in other assemblies" is not clear. You can statically reference the assemblies where you define forms and/or other components and than...
19 Mar 2013 by Sergey Alexandrovich Kryukov
Not only your schema is ugly, it won't really work at all, because it will lead to duplicates, if a user closes not the last file.You can use the following: increment the number every time, per file name. You only need to have unique identification of file buffers, not really a continues set...
4 Jul 2013 by CPallini
(If I got you) have a look at "Managing Processes and Threads in Windows Forms"[^] (see the "Full Example" section).
14 Nov 2013 by Sergey Alexandrovich Kryukov
This is not so easy and probably requires P/Invoke, like finding MDI client window handle via raw Windows API handling WM_ERASEBKGND message. For some background: the real parent (from the stand point of Windows API parent-child relationship at the level of Windows handles), the MDI children are...
9 Oct 2014 by Sergey Alexandrovich Kryukov
I guess this is about understanding or "transparency". In raw effect, nothing is transparent: you just have different colors for different pixels, and the pixel is always 100% opaque.The effect of transparency comes up (rather as a metaphor), when you move some object over non-uniform...
17 Feb 2016 by Jochen Arndt
It seems you already found the asserting line and it tells you what has happened (the messages should have been also printed to the Debug Output window):# ifdef _DEBUG if (m_nMapMode == MM_NONE) { TRACE(traceAppMsg, 0, "Error: must call SetScrollSizes() or...
23 Jan 2019 by Michael Haephrati
If you go over all Windows styles[^], and Extended Windows Styles[^], you should find the answer. Also you can remove the close button using the following code (assuming you get a handle to hwnd): HMENU hMenu = GetSystemMenu( hWnd, 0 ); int nNbItems = GetMenuItemCount(hMenu); ...
19 Feb 2011 by Nguyễn Minh Phúc
I am trying to create MDI windows in WPF, similar to what we have in Winforms. How can I do this?
26 Mar 2011 by Abhinav S
You can start by making sure any third party your child form uses are installed.Try to open the form in design mode and post the error that occurs here and maybe someone can help you.
27 Mar 2011 by Dalek Dave
I am sure there will be more help available if you were to post some of the code.Hard to know what is going on without it, but are you calling the forms correctly? Are there any DLLs attached to the form? Where is the Focus?More information = More Help.
4 Jun 2011 by Chris___808
Venkat and Anna,Thanks for the replies. The following code seems to work with one caveat mentioned below (I decided to stick with CMFCToolBar):void CMyToolBar::EnableButton (int iCmd, BOOL bStatus){ // iCmd is not the index, but the command ID - this way the // buttons can...
25 Jul 2011 by #realJSOP
Add a menu item to your File menu with the label "Open New Instance...", and when the user slects the file to be opened, spawn a new process.I shouldn't have to say this, but if I don't someone else will...That's a fairly bizarre requirement since an MDI app, by it's very nature, allows...
28 Jul 2011 by Michael Waguih
I found the solution by assigning the Start position property of the child form to "center parent"
4 Aug 2011 by YvesDaoust
A way is to permanently store and keep updated the date of the last change. When you launch the application, check if that date has changed and set a new background image. (If the application stays running for long periods, you should check the date, say, every hour also.)Need more details ?
4 Sep 2011 by OriginalGriff
You could set the Form.Autoscroll property[^]...
14 Sep 2011 by Md. Rashim Uddin
Please have a look on that. This is very handy.Header Editable Tab Control in WPF[^]
21 Oct 2011 by André Kraak
Have a look at this Beauty is only Skin-Deep: Skinning your WinForms Application[^].It also explains how to close, move, resize and minimize the irregular shaped form.
25 Mar 2012 by Sergey Alexandrovich Kryukov
It has nothing to do with MDE. You can do it with any control, including System.Windows.Form.Form.First of all, to get mouse coordinates, handle appropriate mouse events; please see:http://msdn.microsoft.com/en-us/library/system.windows.forms.control.aspx[^].Alternatively, subclass...
8 Apr 2012 by Schehaider_Aymen
Was easy, just duplucate the FormView and then duplicate the code of the ParentView in the InitInstance().
31 May 2012 by Maciej Los
Take a look at similar discussion: How to Open Child Window in tab[^]
2 Aug 2012 by obp42
Try this:dgv.CurrentCell = dgv[0, 0];dgv.Rows[0].Selected = false; It seems that CurrentCell for the grid is null until it is displayed or CurrentCell is set programatically and in the past I've been unable to use Selected = true/false until first setting a CurrentCell.I think you...
15 May 2013 by OriginalGriff
Because it is in the constructor. Look at your code:Form2 f2=new Form2();f2.MdiParent=this; The first line of the two calls the constructor for Form2, before the second instruction is executed.Consider moving your code from the constructor into the Form2.Load or Form2.Shown...
4 Oct 2013 by Karale
Hi All. got solution but after removing MDI parent and use simple form.and code this.Hide(); Main main = new Main(); main.Show();As Madhu told. Thanks MadhuFYI.. :)
17 Dec 2013 by Maciej Los
Sergey Alexandrovich Kryukov wrote:Here is the best way of using MDI child: never using MDI. Have a look at His past answers: who needs MDI, ever? Why torturing yourself and scaring off your users?[^]
19 Feb 2015 by Sergey Alexandrovich Kryukov
Unfortunately, with System.Windows.Forms all that semi-transparent control stuff is just not serious. Forget it and consider moving to WPF. In WPF the situation is just the opposite. Anything at all can be semi-transparent.And don't use MDI. This is a separate story. Just don't.—SA
13 Jun 2015 by Dave Kreskowiak
First, get rid of the MDI crap. It's an outdated concept that newb's just abuse to death.MDI stands for "Multiple Document Interface". It was designed for something like, for example, a multi-document Notepad where your child windows are all the same type and do the same thing, like a text...
19 Oct 2015 by George Jonsson
As you are using MFC, you can use CStringT::Tokenize[^] to split every line you read in separate words using the comma (,).Then you can place each word in the array using a loop.
23 Jan 2019 by Chopin2001
I don't know how to remove menubar from dialog that inherit CDockablePane, create by CreateEx function in mainframe of MDI(MFC). My Dialog's problem is have a menubar that have a 'X' icon for close. I want to remove that. Thanks. What I have tried: m_wndOptionBar.CreateEx(NULL, NULL, this,...
16 Jul 2018 by Jochen Arndt
Who will read (and scroll through) 280,000 items? A solution would be using a virtual list control that handles only the items actually visible. See Virtual List Controls | Microsoft Docs[^]. For a non virtual list control you can (and should always even with smaller lists) disable the screen...
4 Oct 2019 by Richard MacCutchan
Quick Access Toolbar - Google Search[^]
5 Oct 2019 by phil.o
Some more links: QAT Persistence[^] Persisting Ribbon State[^]
16 Dec 2019 by OriginalGriff
That is by design: it's is exactly what the Validation event is there for. If the data in the cell isn't valid, it shouldn't be saved - and that is exactly what the system is trying to do: prevent invalid data getting into your backing storage.
22 Jun 2021 by Kyudos
I found it! Had to monitor CChildFrame::OnSysCommand for SC_RESTORE and SC_MAXIMIZE
17 Mar 2011 by Member 7759641
I am a new Visual Basic 2010 programmer and the answer to this question might be beyond my current programming skills, but I need to know if I am on the right track before I start. I am developing a Book Store Management Application that has multiple parts, Textbook Management, Employee...
18 Mar 2011 by Sergey Alexandrovich Kryukov
Most certainly, you should turn all your children into controls and use two or more level hierarchy and choose from tab interface, docking interface, page switch controlled by list box or tree view navigation, or something else in some combination.MDI is a poor help here and is generally...
28 Jul 2011 by Michael Waguih
Hi all,In my project I have a MDI_Parent form where I can show several MDI_Child.When opening any Child_Form it is running well but when closing the one at the front, only the MDI_Parent appears and the Child_Form titles appear with the boxes minimize , maximize and Exit.On maximize...
24 May 2011 by soulprovidergr
Hi, Is there any way to load forms compiled in other project assemblies(.dll files) using interfaces ? Has anyone some code example.I am currently developing a Windows Application using Mdi childs children [SA] and ribbons and I need to dynamicaly load forms depending on assemblies found on...
26 May 2011 by Yvan Rodrigues
So are you trying to achieve: +--> MDI_Child | MDI_Parent --+--> MDI_Child | +--> MDI_Child or +--> MDI_Child --> MDI_Child | MDI_Parent --+ | +--> MDI_Child?
10 Jul 2011 by Sig Pimp
I would like to code up a program that has a parent window/form that would have a region of it that will be a "selectable" child form from menu items.The path I currently am on is trying to "nest" a child form in a panel control on the parent window. However, I'm having trouble trying to...
12 Jul 2011 by Sig Pimp
I'm playing around with MDI (I know, I know...torturing myself. I guess I like pain.) and have an issue with child form controls not showing up after setting the child form dockstyle to fill when the child form is created.Parent Form:using System;using...
12 Jul 2011 by Syed Salman Raza Zaidi
Hi,From your parent form go to properties window and set IsMdiContainer value to true
4 Sep 2011 by Michael Waguih
Hi all,I have an MDI Child in which I was assigning its minimum size so the user couldn't resize it smaller than the minimum size already assigned, but the MDI parent can have a smaller size.I want to show an auto scroll if the MDI Parent has a size less than The MDI Child size, but I...
7 Sep 2011 by Rakesh Meel
When u check MDI forms property .there is an option Autoscroll property by default =False u must change the property False into true.
14 Sep 2011 by Kishore Jangid
I am thinking of developing a MDI in WPF...After googling i came to know that it can be achieved through Tab Control with User Control Library in WPF...Now my question is After Creating My Window in a UserControl and then using XAML code to call the user control...When the Main Window...
2 Oct 2011 by HatemGamal
In my mdi application i have four mdichild forms, one of them is used as a background and holding some controls..How to prevent this background mdichild form from getting focus/activation when switching between other mdichild forms using Ctrl+Tab?In other word how to skip this background...
2 Oct 2011 by E.F. Nijboer
Have a look at the answer here:http://social.msdn.microsoft.com/Forums/en-AU/winforms/thread/d19e23ec-11f5-4ce5-9c1e-98b33becb9d5[^]Good luck!
2 Oct 2011 by Sergey Alexandrovich Kryukov
Well, don't do it. What are you trying to do would be the abuse of MDI design. Moreover, MDI itself is the abuse of reasonable UI design. Who seriously use MDI?Sorry for not answering your question; but listen to a good friendly advice: don't use this feature strongly discouraged by...
24 Oct 2011 by saint1997
I have a borderless form that is captured by an MDI Parent form. I am also capturing other applications onto the main form so I am using the SetParent method in user32.dll. I have a ToolStrip on the form that is being captured, and when I click on the menu items, they do not open....
2 Jan 2012 by Anthony Dilshan
- How to bring a MDI child form to the front when MDI Parent has some controls in itI have created a "MDI Parent" form containing a Split Container & Tree View Controls, when i try to open a Form (MDI Child), that form opens behind the Split Container. Could some one please explain how to...
2 Jan 2012 by Wendelius
MDI parent form should not have any controls on it excluding status bar or menu bar etc. MDI children are drawn behind the controls on MDI parent.Also if this is a new software consider moving to SDI interface since MDI is deprecated actually a long time ago. For new users SDI is more...
2 Jan 2012 by Sergey Alexandrovich Kryukov
This is problematic because the MDI parent is not designed to host any controls except one. This control (which you can access using raw Windows API) is so called MDI client, it takes the whole client area of the MDI parent and is only designed to host MDI children. I remember that even the...
6 Feb 2012 by Sasa Kajic
Hi,one solution I found and using is overriding OnMDIActivate of ChildFrame...void CChildFrame::OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd){ CMDIChildWndEx::OnMDIActivate(bActivate, pActivateWnd, pDeactivateWnd); CWnd* pWnd =...
7 Feb 2012 by Sasa Kajic
Hi, one solution I found and using is overriding OnMDIActivate of ChildFrame... void CChildFrame::OnMDIActivate(BOOL bActivate, CWnd* pActivateWnd, CWnd* pDeactivateWnd){ CMDIChildWndEx::OnMDIActivate(bActivate, pActivateWnd, pDeactivateWnd); CWnd* pWnd =...
15 Feb 2012 by SHWRRMSH
I read this article on creating multiple splitter views on a Window using an MFC SDI Application. http://www.vckbase.com/english/code/doc_view/SdiMulti.shtml.htm How can I choose the split (For eg:- 1x2, 3x1 etc.,) from the menu bar and split the *current window* (not a new window) for an...
16 Feb 2012 by Richard MacCutchan
Pleas do not post the same question in multiple places; you already posted this here[^].
7 Apr 2012 by Schehaider_Aymen
Hello all,I Have an MDI MFC application un der VS2005, I have some doc/view classes (like CUsersDoc/CUsersView). I was attempting to create a new pair of (Doc/View) and i could not how to do that: I created a Document Based Class then i Created a CFormView Based One With The Doc...
9 Apr 2012 by amityadav4a
I am not getting menu and MDI working in my application Please help.include "windows.h"#include "resource.h"#define IDR_MENU1 2#define IDR_MENU2 3#define IDR_MENU3 3#define IDM_FIRSTCHILD 50000LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;BOOL CALLBACK...
9 Apr 2012 by Resmi Anna
you have given menu name as NULLwndclass.lpszMenuName = NULL;give it correct as belowwndclass.lpszMenuName = MAKEINTRESOURCE(IDC_MENU1/*resource name of your menu item*/);
23 Apr 2012 by Parabola949
I know this is old, but the answer is to set the MDI Parent as such, and the MDI Child Form to AutoScroll = true. I just had the same problem, this was what worked for me.
25 Apr 2012 by 01.mandar
Hi FriendsI have created a MDI form in that i have 2 forms (treeview form and information form)in 2nd (information form) i have added 2 buttons next and previousminimize, maximize works on all of client form correctly(before any click on 2nd form)Problem:when i click button...
25 Apr 2012 by JohnCz
Could you please clarify what do you mean by the form?You are referring to forms as treeview form and information form. Are forms dialogs?Also, could you give more detailed information about sizing problem?If you do not click anything, does the client window changes size? What class is...
31 May 2012 by Sandeep Mewara
It does not work like this here.Here is what is expected of enquirers:1. TRY first what you want to do! You may find that it's not that hard.2. Formulate what was done by you that looks like an issue/not working. Try them and tell if you face issues.Members will be more than happy...
17 Jun 2012 by Richard MacCutchan
WM_NCACTIVATE[...
2 Sep 2012 by MR. AngelMendez
Hi, I made two separate programs, the first one is supposed to capture the other program and the second one is supposed to show a messagebox stating that it has been captured.first question: How do I get program 1 to capture any running program, like a "black hole"?second question: How...
2 Sep 2012 by AmitGajjar
Hi,What you are asking may be possible but i am not prefer to access running program directly. Instead what i suggest you to create one Intermediate XML file for transmitting data between both the application. I don't know what you would like to achieve from attaching both the...
29 Oct 2012 by Member 8718077
i have an mdi parent form and two child forms.on button click from form1, form 2 should be opened and on a radiobutton selection, i need to retrieve that radio button text to my first form text box. i send the data and displayed it on form1 using delegatesbut i used a new object of...
1 Nov 2012 by Yoldas Askan
Hi, I am trying to access globally variables declared in MainFrame of my solution from a thread that starts in my CMyView.cpp. How can I access these parameters without the CMainFrame * _MainFrame; in my structure THREADVIEW in CMyView.h, as below? Any ideas?typedef struct THREADVIEW{ ...
1 Nov 2012 by JackDingler
You could access it there, but it's a bad idea as you'd need to lock the MainFrame and that can get dirty and complex.I recommend that you create a singleton class to handle your globals. Keep the member variables protected and provide thread safe access methods for the data.Something...
1 Nov 2012 by CPallini
If the variables are global then you can access them (simply declare them extern in your thread source file).
1 Nov 2012 by Eugen Podsypalnikov
1. You have a memory leak now, fix:// cpp:void CYourView::OnSprint(){ //.. THREADVIEW sPar = { this }; // on-stack instance, will be automatically "deleted" AfxBeginThread(ChangeColorThread, &sPar); // note: you could pass this directly as well //..}2. Your thread parameter...
14 Feb 2013 by Sergey Alexandrovich Kryukov
First of all, the question makes no sense. There is no such thing as "add application to an application".If you simply mean that you want to run an application (start a child process), you can do it, but what are you going to do with it? Processes are very well isolated. If they are not...
11 Apr 2013 by U@007
hi allI am working on windows application with mdi formin that I have status bar displaying 3 messages but I given width it's not giving gap.So How to give a space between status bar text?in my resultName: appname |domain/user |date:04/12/2013I wantName: app name ...
11 Apr 2013 by Harikamalina
go to to the toolbar->select the status-bar from the tool bar->select the properties of status bar.(triangle which is displayed on status bar)->click the edit items..add label ->go to the properties of label.. select the text property of label enter a text like "NAME" press "space bar "...
11 Apr 2013 by E.F. Nijboer
Try setting AutoSize to False first and then set the width. Instead, you could also set MinWidth instead of Width. MinWidth will work with AutoSize but prevents the panel from becoming too small. Good luck!
15 May 2013 by Luci C
Form1 f1=new Form1();f1 is the main formf1 is an Mdi Container;Form2 f2=new Form2();f2.MdiParent=this; f2.show();Now, in constructor of the f2 I have:Form1 f1=(Form1)this.MdiParent; // ERROR But MdiParent is NULL...Why?Thank you...
20 Jun 2013 by Leo Chapiro
Take a look at this project, HTH: Multiple Window Interface for WPF[^]Good luck for you!
25 Jun 2013 by samuelkod
Please I am new in C# and i need your help.I have created a single instance csharp application that uses mdi forms using the necessary code that i find on the web most especially here at http://www.codeproject.com[^] . My question is how do I create a new mdi tab or child when a user...
1 Jul 2013 by NeonMika
Hey guys, I hope you can help me out, I cannot find a solution for the following problem:We have on MainMenuStrip. And when a mdi child is opend, it's icon is shown on the left side of this. Everything is fine so far.But when I have two mdi childs and want to switch between them, the "mdi...
9 Jul 2013 by Shargon_85
if (!OnlyOneProcess()) {[] send = Encoding.UTF8.GetBytes("ExecuteLink=Something");SendUDP(IPAddress.Loopback, MY_PORT, send, false); } public static bool SendUDP(IPAddress ip, ushort port, byte[] send, bool is_broadcast) { try ...
31 Jul 2013 by Shivani Dash
Hi,I am working on windows application. My form is MDI form. In my form I have two panel,two button like "TOTAL" and "CUSTOMER". So when i am clicking the TOTAL button the total panel should display and when to CUSTOMER the customer panel should display respectively. I have sqiz dt panel...
1 Aug 2013 by Sushil Mate
There are some properties of form for setting up the location of the controls on form. Even Control has the Control.Dock[^] & Control.Anchor[^] for setting up the controls position.Size & Location which you added hard coded will not work on every system, As you might know every system might...
4 Oct 2013 by Karale
Thanks Madhu for replying but i am still facing the same. I have inserted below code.else { Login login = new Login(); login.Hide(); Main main = new Main(); main.Show(); ...
4 Oct 2013 by Karale
Thanks thatraja but your solution is also insufficient .. :(
4 Oct 2013 by Karale
Hi, I am developing an application in Visual Studio 2010 for this is have created Login form which takes credentials from SQL server 2008 and log in. Everything goes right till here. I wish that when user login with correct credentials login form should be closed and MDI parent form should be...
4 Oct 2013 by Madhu Nair
Write Login.hide() before Main.show()
4 Oct 2013 by thatraja
You have to close the login form when you show the main form. Check this.Winforms: Close your form during Load event[^]
10 Oct 2013 by Santhosh Kumar
HII have a requirement to convert tiff to searchable pdf, i was sucessfull in converting tiff to mdi file which is searchable using MODI, and now i am dying how to convert mdi to pdf using c#.can any suggest me here.Thanks in advance.
27 Oct 2013 by reddy_rock
Hi AllI have a ProblemI have a Parent Form F1 and it has a label. While On Form Load(F1),The form F2 Will be Appeared In Form F1 and That From F2 has a Button and A label , While i was click on button Form F2 will be hide and Label text(F2) that has to be copied to Label that has present...
6 Nov 2013 by Ziee-M
Hi,i finally found a useful old post! check the solution number 2how to enable the buttons which are in parent form from child form in C#.net[^]Hope it helps.
14 Nov 2013 by JOE Heart Under Blade
halo, i have a mdi parent my mdi parent are contain menustrip and when i click one of the menustripitem will be call or popup one of form child.i m setting up a background image to my mdi parent.when i import the image the is no problem appear.i can set and change the background...
9 Dec 2013 by AngelBlueSky
Hello, I made an mdi program and I load dinamically some child form this way:Assembly newDll = Assembly.LoadFile("Child_01.exe");Type type = newDll.GetType("Child.Form1");Object obj = Activator.CreateInstance(type);Form child = (Form)Activator.CreateInstance(type);child.MdiParent...
17 Dec 2013 by kool15th
I have made a application on windows forms and made mdi form and child forms. I have a reader and its connection has to be closed on form close. I have managed it for Form CLosed Event. But When its closed from mdi form its not. I want to code on the event of close when closed from the mdi...
26 Jan 2014 by HermiHermer
Hello,after migrating my project from Visual Studio 2008 to 2012, I missed the repainting of the MDI-Client-Window while moving the Child-Frame. My project consists of a lot of different child-frame classes. After closing all childs the MDI-Client-Window will be repainted. Minimize and...