protected unsafe override void WndProc(ref Message m) { switch (m.Msg) { // #define WM_WINDOWPOSCHANGED 0x0047 // #define SWP_NOZORDER 0x0004 case 0x47: WINDOWPOS *ppos = (WINDOWPOS *)m.LParam; if (ppos == null || (ppos->flags & 4) == 0) { DocManager.SetActiveDocument(typeof(LevelDoc), m_doc); DocManager.SetCommandTarget(this); } break; // #define WM_NCACTIVATE 0x0086 case 0x86: if (((ushort)m.WParam) != 0) { DocManager.SetCommandTarget(this); } break; } base.WndProc(ref m); }
public LevelFrame(Form frmParent, Document doc, Type typeView) { InitializeComponent(); LevelDocTemplate doct = (LevelDocTemplate)DocManager.FindDocTemplate(typeof(LevelDoc)); doct.DocActive += new LevelDocTemplate.DocActiveHandler(LevelDocTemplate_DocActive); m_doc = doc; doc.PathChanged += new Document.PathChangedHandler(Document_PathChanged); doc.ModifiedChanged += new Document.ModifiedChangedHandler(Document_ModifiedChanged); doc.OpenCountChanged += new Document.OpenCountChangedHandler(Document_OpenCountChanged); ((LevelDoc)doc).NameChanged += new LevelDoc.NameChangedHandler(LevelDoc_NameChanged); // Parent this and create panes MdiParent = frmParent; ChangePanes(2); // See if the top most mdi frame is maximized. If so, maximize this too // If no window around, maximize bool fMaximize = true; if (frmParent.ActiveMdiChild != null) { if (frmParent.ActiveMdiChild.WindowState != FormWindowState.Maximized) { fMaximize = false; } } if (fMaximize) { WindowState = FormWindowState.Maximized; } // Set Title s_alsFrames.Add(this); SetTitle(); // If this doc is active, this is the new command target if (m_doc == DocManager.GetActiveDocument(typeof(LevelDoc))) { DocManager.SetCommandTarget(this); } // Show Show(); }