public class GIFFormat : ExportFormat
Public Class GIFFormat Inherits ExportFormat
public class GIFFormat : ExportFormat
Public Class GIFFormat Inherits ExportFormat
//This example demonstrates how to export a layout to GIF. //Added references using ArcGIS.Desktop.Core; //Project using ArcGIS.Desktop.Layouts; //Layout classes using ArcGIS.Desktop.Framework.Threading.Tasks; //QueuedTask using ArcGIS.Desktop.Mapping; //Export formats public class ExportLayoutToGIFExample { public static Task ExportLayoutToGIFAsync(string LayoutName, string Path) { //Reference a layoutitem in a project by name LayoutProjectItem layoutItem = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault(item => item.Name.Equals(LayoutName)); if (layoutItem == null) return Task.FromResult<Layout>(null); //Create GIF format with appropriate settings GIFFormat GIF = new GIFFormat(); GIF.Resolution = 300; GIF.OutputFileName = Path; return QueuedTask.Run(() => { //Export Layout Layout lyt = layoutItem.GetLayout(); //Loads and returns the layout associated with a LayoutItem if (GIF.ValidateOutputFilePath()) { lyt.Export(GIF); } }); } }
//This example demonstrates how to export an individual map frame on a layout to GIF. //Added references using ArcGIS.Desktop.Core; //Project using ArcGIS.Desktop.Layouts; //Layout classes using ArcGIS.Desktop.Framework.Threading.Tasks; //QueuedTask using ArcGIS.Desktop.Mapping; //Export formats public class ExportMapFrameToGIFExample { public static Task ExportMapFrameToGIFAsync(string LayoutName, string MFName, string Path) { //Reference a layoutitem in a project by name LayoutProjectItem layoutItem = Project.Current.GetItems<LayoutProjectItem>().FirstOrDefault(item => item.Name.Equals(LayoutName)); if (layoutItem == null) return Task.FromResult<Layout>(null); //Create GIF format with appropriate settings GIFFormat GIF = new GIFFormat(); GIF.HasWorldFile = true; GIF.Resolution = 300; GIF.OutputFileName = Path; return QueuedTask.Run(() => { //Export MapFrame Layout lyt = layoutItem.GetLayout(); //Loads and returns the layout associated with a LayoutItem MapFrame mf = lyt.FindElement(MFName) as MapFrame; GIF.OutputFileName = Path; if (GIF.ValidateOutputFilePath()) { mf.Export(GIF); } }); } }
//This example demonstrates how to export the active mapview to GIF. //Added references using ArcGIS.Desktop.Framework.Threading.Tasks; //QueuedTask using ArcGIS.Desktop.Mapping; //MapView and Export formats public class ExportActiveMapToGIFExample { public static Task ExportActiveMapToGIFAsync(string Path) { return QueuedTask.Run(() => { //Reference the active map view MapView mapv = MapView.Active; //Create GIF format with appropriate settings GIFFormat GIF = new GIFFormat(); GIF.Resolution = 300; GIF.Height = 500; GIF.Width = 800; GIF.HasWorldFile = true; GIF.OutputFileName = Path; //Export active map view if (GIF.ValidateOutputFilePath()) { mapv.Export(GIF); } }); } }
GIFFormat GIF = new GIFFormat();
System.Object
ArcGIS.Desktop.Mapping.ExportFormat
ArcGIS.Desktop.Mapping.GIFFormat
Target Platforms: Windows 11, Windows 10