自己写的一个简单的Winform 程序,加载地图:
private void Form1_Load(object sender, EventArgs e)
{
LoadMap();
} private void LoadMap()
{
this.Cursor = Cursors.WaitCursor;
Application.DoEvents();
string sFilePath = @"D:\地图配置\map\ChangZhouLayer\常州.mxd";
if (MainMap.CheckMxFile(sFilePath))
{
MainMap.MousePointer = esriControlsMousePointer.esriPointerHourglass;
MainMap.LoadMxFile(sFilePath);
MainMap.MousePointer = esriControlsMousePointer.esriPointerDefault;
this.Cursor = Cursors.Default;
}
else
{
MessageBox.Show("选择打开的地图文档无效", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
} 初学AE 开发现在界面有一打印按钮,急求打印代码,忘个大侠不吝赐教,小女子感激不尽!
private void Form1_Load(object sender, EventArgs e)
{
LoadMap();
} private void LoadMap()
{
this.Cursor = Cursors.WaitCursor;
Application.DoEvents();
string sFilePath = @"D:\地图配置\map\ChangZhouLayer\常州.mxd";
if (MainMap.CheckMxFile(sFilePath))
{
MainMap.MousePointer = esriControlsMousePointer.esriPointerHourglass;
MainMap.LoadMxFile(sFilePath);
MainMap.MousePointer = esriControlsMousePointer.esriPointerDefault;
this.Cursor = Cursors.Default;
}
else
{
MessageBox.Show("选择打开的地图文档无效", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
} 初学AE 开发现在界面有一打印按钮,急求打印代码,忘个大侠不吝赐教,小女子感激不尽!
解决方案 »
- 我的数据库有个数组,是我将excel文件存进去的,我现在想把他另存到其他地方,大家帮我看看,那里写错了
- DadaSet分页问题
- C#动态加载程序库的问题
- 急,急,急,导入excel出现乱码问题??
- winform程序加到注册表启动项后不随开机启动
- 关于DataGridView中新增记录!
- 关于 Load 树 的速度问题,大家赐教赐教,多谢的话就不多说了 ....
- 征集在C#难解问题(给分100)了
- C#开发的nt服务程序,如何取得程序运行时的实际路径。
- 100分求一算法!!
- 请问为什么用webBrowser访问网页不能注册呢?
- 问一个泛型list<string> 转换成字符串的问题,关键是每个元素要加单引号
AE, C#,按纸张打印地图
private void PrintAuto(IActiveView pActiveView)
{ IPaper pPaper = new Paper();
IPrinter pPrinter = new EmfPrinterClass(); System.Drawing.Printing.PrintDocument sysPrintDocumentDocument = new System.Drawing.Printing.PrintDocument(); pPaper.PrinterName = sysPrintDocumentDocument.PrinterSettings.PrinterName;
pPrinter.Paper = pPaper; int Resolution = pPrinter.Resolution; double w, h;
IEnvelope PEnvelope = pActiveView.Extent;
w = PEnvelope.Width;
h = PEnvelope.Height;
double pw, ph;//纸张
pPrinter.QueryPaperSize(out pw, out ph);
tagRECT userRECT = pActiveView.ExportFrame; userRECT.left = (int)(pPrinter.PrintableBounds.XMin * Resolution);
userRECT.top = (int)(pPrinter.PrintableBounds.YMin * Resolution); if ((w / h) > (pw / ph))//以宽度来调整高度
{ userRECT.right = userRECT.left + (int)(pPrinter.PrintableBounds.Width * Resolution);
userRECT.bottom = userRECT.top + (int)((pPrinter.PrintableBounds.Width * Resolution) * h / w);
}
else
{
userRECT.bottom = userRECT.top + (int)(pPrinter.PrintableBounds.Height * Resolution);
userRECT.right = userRECT.left + (int)(pPrinter.PrintableBounds.Height * Resolution * w / h); } IEnvelope pDriverBounds = new EnvelopeClass();
pDriverBounds.PutCoords(userRECT.left, userRECT.top, userRECT.right, userRECT.bottom); ITrackCancel pCancel = new CancelTrackerClass();
int hdc = pPrinter.StartPrinting(pDriverBounds, 0); pActiveView.Output(hdc, pPrinter.Resolution,
ref userRECT, pActiveView.Extent, pCancel); pPrinter.FinishPrinting();}
调用
PrintAuto(this.axMapControl1.ActiveView);
这些资料也有,就是想结合Winform 的打印控件:Printer 之类的,可以让用户选择纸张,预览,打印设置等人性化的适合用户简单操作的界面,有做过这类的朋友希望多多指教,好几天了,还是没什么思路。