Arcengine development log_export Map

Source: Internet
Author: User

 The map export function is implemented as an image, and the code is complex.

  

 

   

 

Using system;
Using system. drawing;
Using system. runtime. interopservices;
Using ESRI. ArcGIS. ADF. baseclasses;
Using ESRI. ArcGIS. ADF. catids;
Using ESRI. ArcGIS. CARTO;
Using ESRI. ArcGIS. controls;
Using ESRI. ArcGIS. esrisystem;

Using ESRI. ArcGIS. geometry;
Using ESRI. ArcGIS. output;
Using ESRI. ArcGIS. systemui;
Using ESRI. ArcGIS. display;
Using system. Windows. forms;

 

 Public partial class form1: Form
   {
       [Dllimport ("gdi32.dll")]
       Public static extern int getdevicecaps (int hdc, int nindex );

       
       [Dllimport ("user32.dll")]
       Public static extern int getdc (INT hwnd );

       [Dllimport ("user32.dll")]
       Public static extern int releasedc (INT hwnd, int HDC );

       // [Dllimport ("user32.dll", setlasterror = true)]
       // Static extern bool systemparametersinfo (uint uiaction, uint uiparam, intptr pvparam, uint fwinini );

       [Dllimport ("user32.dll", setlasterror = true)]
       Static extern bool systemparametersinfo (uint uiaction, uint uiparam, ref int pvparam, uint fwinini );

       
       Const uint spi_getfontsmoothing = 74;
       Const uint spi_setfontsmoothing = 75;
       Const uint spif_updateinifile = 0x1;
       
       
       Public form1 ()
       {
           Initializecomponent ();
       }


       Private void btnexport_click (Object sender, eventargs E)
       {
           Mapexportdialog. filter = "JPEG format (*. JPG) | *. JPG | EPS format (*. EPS) | *. EPS | EMF format (*. EMF) | *. EMF | BMP format (*. BMP) | *. BMP | PDF format (*. PDF) | *. PDF | TIFF Format (*. TIF) | *. TIF | PNG format (*. PNG) | *. PNG | SVG format (*. SVG) | *. SVG | ai format (*. AI) | *. ai | all formats (*. *) | *. *";
           Mapexportdialog. restoredirectory = true;
           If (mapexportdialog. showdialog () = dialogresult. OK)
           {
               String strlocalfilename = mapexportdialog. filename. tostring ();
               // Obtain the file path without the file name
               String strfilepath =Strlocalfilename. substring (0, strlocalfilename. lastindexof (");
               String strfilename = strlocalfilename. substring (strlocalfilename. lastindexof ("\") + 1, strlocalfilename. lastindexof (".")-3 );

             //MessageBox. Show (strfilepath );
              // MessageBox. Show (strfilename );

               String pictype;
               Switch (mapexportdialog. filterindex)
               {
                   Case 1:
                       Pictype = "Jpeg ";
                       Break;
                   Case 2:
                       Pictype = "EPS ";
                       Break;
                   Case 3:
                       Pictype = "EMF ";
                       Break;
         

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.