MDI Parent Problem

556
0
04-10-2013 11:25 PM
sercanpehlivan
New Contributor
I have a form called ChildForm and it includes a globeControl. When i try to add a layer when ChildForm is created(in its constructor) and give it to a form called ParentForm layer is not seen. ParentForm is an mdiContainer and ParentForm is the MDIParent of the ChildForm.However, when ChildForm includes a mapControl and when i try the same case layer is seen. As far as i understand 3D ESRI component does not support mdiParent. Am i wrong? Is there a way to make a 3D ESRI component as MDIParent?

Any help will be appreciated.

Here is my code:
In the parent form when the button is pressed , childform is created.

     //Form4 is the childForm
    public partial class Form4 : Form
    {

        public Form4()
        {
            InitializeComponent();

            addFeatureLayer();

        }

        private void addFeatureLayer()
        {
            //create a feature layer
            IFeatureLayer featureLayer = new FeatureLayer();
            IWorkspaceFactory wf = new ShapefileWorkspaceFactory();
            IFeatureWorkspace workspace = (IFeatureWorkspace)wf.OpenFromFile("D:\\ROGIS_YENI\\trunk\\codes\\ornek veriler\\GSHHS", 0);
            IFeatureClass featureClass = workspace.OpenFeatureClass("GSHHS_l_L1.shp");
            featureLayer.FeatureClass = featureClass;

            ((ILayer)featureLayer).Name = "Globe";

            axGlobeControl1.GlobeDisplay.Scene.AddLayer((ILayer)featureLayer, true);

            axGlobeControl1.GlobeDisplay.RefreshViewers();
        }
   }



//Form2 is the parentForm

public partial class Form2 : Form
    {
        //MainForm mainform;

        Form4 mrm;
        private IGlobeControl m_globeControl;

        public Form2()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.IsMdiContainer = true;

            mrm = new Form4();

            mrm.MdiParent = this;

            mrm.Show();

        }
}
0 Kudos
0 Replies