代码实现IMapcontrol当前视图输出为图片功能
2024-10-13 06:44:57
SaveFileDialog dialog = new SaveFileDialog();
dialog.Title = "保存输出图片";
dialog.Filter = "JPG文件(*.jpg)|*.jpg|BMP文件(*.bmp)|*.bmp||";
if (dialog.ShowDialog() == DialogResult.OK)
{
tagRECT grect;
string str = System.IO.Path.GetExtension(dialog.FileName).ToLower();
IExport export = null;
if (str == ".jpg")
{
export = new ExportJPEGClass();
}
else
{
export = new ExportBMPClass();
}
export.ExportFileName = dialog.FileName;
int num = 0x60;
int num2 = ;
export.Resolution = num2;
grect.left = ;
grect.top = ;
tagRECT deviceFrame = this.m_pMapControl.ActiveView.ScreenDisplay.DisplayTransformation.get_DeviceFrame();//.DeviceFrame;
grect.right = (int) (((deviceFrame.right - deviceFrame.left) * num2) / ((double) num));
grect.bottom = (int) (((deviceFrame.bottom - deviceFrame.top) * num2) / ((double) num));
IEnvelope envelope = new EnvelopeClass();
envelope.PutCoords((double) grect.left, (double) grect.top, (double) grect.right, (double) grect.bottom);
export.PixelBounds = envelope;
int hdc = export.StartExporting();
double resolution = export.Resolution;
this.m_pMapControl.ActiveView.Output(hdc, (int) resolution, ref grect, null, null);
export.FinishExporting();
export.Cleanup();
}
最新文章
- Memcache的增删改查
- IIS7.5支持解析读取.json文件数据
- Shell概述
- linux dsp 播放音频文件
- Android开发之初识Camera图像采集
- 1190: [HNOI2007]梦幻岛宝珠 - BZOJ
- Java中List的排序
- 读书笔记之 - javascript 设计模式 - 适配器模式
- shell检测interface是否已分配ip,qt调用shell脚本
- 《Effective C++》:规定44-规定45
- Git基础命令的使用
- MySQL 服务安装及命令使用
- 【kmp】 剪花布条 HDU - 2087
- react-native android 权限问题
- Docker容器管理及代码调用
- TCP/IP 三次握手,温故知新
- 【Java并发编程二】同步容器和并发容器
- VMware Workstation 11 中 Ubuntu 14.04 的 VMware Tools 问题 :没有显示共享文件夹
- 推荐一款编辑SQL的工具:jsqlparser
- C++(一)——HelloWorld