Пример #1
0
        //Returns the map title as string given the IApplciation variable of the current mxd
        public static string getPageSize(IMxDocument pMxDoc, string pFrameName)
        {
            string pageSize = null;
            Dictionary <string, string> mapProps = LayoutElements.getDataframeProperties(pMxDoc, pFrameName);
            string pageFormId = mapProps["page_size"];

            Dictionary <string, string> pageSizes = new Dictionary <string, string>();

            pageSizes.Add("esriPageFormLetter", "Letter");
            pageSizes.Add("esriPageFormLegal", "Legal");
            pageSizes.Add("esriPageFormTabloid", "Tabloid");
            pageSizes.Add("esriPageFormC", "C");
            pageSizes.Add("esriPageFormD", "D");
            pageSizes.Add("esriPageFormE", "E");
            pageSizes.Add("esriPageFormA5", "A5");
            pageSizes.Add("esriPageFormA4", "A4");
            pageSizes.Add("esriPageFormA3", "A3");
            pageSizes.Add("esriPageFormA2", "A2");
            pageSizes.Add("esriPageFormA1", "A1");
            pageSizes.Add("esriPageFormA0", "A0");
            pageSizes.Add("esriPageFormCUSTOM", "Custom");
            pageSizes.Add("esriPageFormSameAsPrinter", "Same as printer");

            foreach (var i in pageSizes)
            {
                if (pageFormId == i.Key)
                {
                    pageSize = i.Value;
                }
            }
            return(pageSize);
        }
Пример #2
0
        //Returns the map title as string given the IApplciation variable of the current mxd
        public static string getScale(IMxDocument pMxDoc, string pFrameName)
        {
            Dictionary <string, string> mapProps = LayoutElements.getDataframeProperties(pMxDoc, pFrameName);
            string scale;
            int    temp_scale;

            int.TryParse(mapProps["scale"], out temp_scale);
            scale = "1: " + temp_scale.ToString("n0");
            return(scale);
        }