private void GraticuleForm_FormClosed(object sender, FormClosedEventArgs e)
 {
     Graticule.GraticuleExtentChanged -= OnGraticuleExtentChanged;
     Graticule.MapRedrawNeeded        -= OnRedrawNeeded;
     _instance   = null;
     _parentForm = null;
     CleanUp();
 }
 public static GraticuleForm GetInstance(MapperForm parent)
 {
     if (_instance == null)
     {
         _instance = new GraticuleForm(parent);
     }
     return(_instance);
 }
        public void ShowGraticuleForm()
        {
            _graticule = new Graticule(axMap, _mapLayersHandler);
            var gf = GraticuleForm.GetInstance(this);

            if (!gf.Visible)
            {
                gf.Show(this);
            }
            else
            {
                gf.BringToFront();
            }
            if (MapLegend != null)
            {
                MapLegend.Graticule = _graticule;
            }
            gf.GraticuleRemoved += OnGraticuleRemoved;
        }
        public void SetGraticuleTitle(string title)
        {
            bool formFound = false;

            if (Graticule != null)
            {
                foreach (Form f in Application.OpenForms)
                {
                    if (f.Name == "GraticuleForm")
                    {
                        GraticuleForm frm = (GraticuleForm)f;
                        frm.SetGraticuleTitle(title);
                        formFound = true;
                        break;
                    }
                }
                if (!formFound)
                {
                    Graticule.MapTitle = title;
                    Graticule.Refresh();
                }
            }
        }