Beispiel #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 = PageLayoutProperties.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);
        }
Beispiel #2
0
        //Returns the map title as string given the IApplciation variable of the current mxd
        public static string getScale(IMxDocument pMxDoc, string pMapFrameName)
        {
            string scale;

            if (detectMapFrame(pMxDoc, pMapFrameName))
            {
                Dictionary <string, string> mapProps = PageLayoutProperties.getDataframeProperties(pMxDoc, pMapFrameName);
                long temp_scale = Convert.ToInt64(mapProps["scale"]);
                scale = "1: " + string.Format("{0:n0}", temp_scale);
                return(scale);
            }
            else
            {
                return("Map frame not found");
            }
        }