/// <summary>
        /// Removes proxy for specified image layer (must render grid directly)
        /// </summary>
        public static void RemoveGridProxyForLayer()
        {
            var img = axMap1.GetActiveLayer();

            if (img == null)
            {
                return;
            }

            var grid = img.OpenAsGrid();

            if (grid != null)
            {
                if (img.IsGridProxy)
                {
                    int handle = axMap1.get_LayerHandle(LAYER_POSITION);
                    axMap1.RemoveLayer(handle);
                    img.Close();
                }

                if (!grid.RemoveImageProxy())
                {
                    MessageBox.Show("Failed to remove image proxy");
                }
            }
        }