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;