Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Mdi Program Problem

Mdi Program Problem

Scheduled Pinned Locked Moved C#
questionhelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ali_reza_zareian
    wrote on last edited by
    #1

    Hi, I have an mdi program.for this program I must use splitContainer so when I want to show child form it doesn’t appear however child form was created. So for solving this problem I added child form to the splitContainer panel. My code is like this: Form1 frm=new Form1(); frm.MdiParent=this; splitContainer.Panel1.Controls.add(frm); frm.show(); Now my child form was shown but when it gets focuses its titlebar was inactive yet. I mean it gets focuses but the child form titlebar doesn’t change to be active.So user who will work with this program doesnt know if it gets fouses or not. What is my wrong for this happening?! Does it another way to show child form when we have splitContainer in mdi Programs?

    D 1 Reply Last reply
    0
    • A ali_reza_zareian

      Hi, I have an mdi program.for this program I must use splitContainer so when I want to show child form it doesn’t appear however child form was created. So for solving this problem I added child form to the splitContainer panel. My code is like this: Form1 frm=new Form1(); frm.MdiParent=this; splitContainer.Panel1.Controls.add(frm); frm.show(); Now my child form was shown but when it gets focuses its titlebar was inactive yet. I mean it gets focuses but the child form titlebar doesn’t change to be active.So user who will work with this program doesnt know if it gets fouses or not. What is my wrong for this happening?! Does it another way to show child form when we have splitContainer in mdi Programs?

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      You're using two things that cannot work together. You're treating the child form as both and MDI child and as a Control. You only do one, not both. If you're going to put this form into a Panel control, you have to treat it as a Control and not a form that has no parent (or the parent is the Desktop window.) You cannot have it as an MDI Child. But, in order to treat it as a Control, you have to tell the form that it is no longer a top-level form.

      Form1 frm = new Form1();
      frm.TopLevel = false;
      splitContainer.Panel1.Controls.Add(frm);
      

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups