don't execute the ESRI's command, just find out and write codes to zoom to the raster resolution. Here they are, I hope they will help.

Unfortunately (to you) I wrote these codes under C#. I hope you could manage the transfer these codes to VB. If not, feel free to contact me for further help. Because of this I'll write here some theory of mine too.

There are two possible way to solve this question. 
1. You want to run this under ArcMap (ArcCatalog) environment. 
2. You want to use this under your own MapControl and ToolBarControl with a raster (picture) where the Spatial Reference wasn't set.

My solutions: 
1. 
You can work with MxDoc and you have set up Spatial Reference for the Map. Therefore you can use the IRasterOutputSettings::RasterRatio method, which will give back the necessary ratio (number). 
In this case you can cast (QI in VB) to this interface from IDisplayTransformation. 
Finally the formula here to calculate the raster resolution is:

new map scale = old map scale / raster ratio.

See the code later.

2. 
If you use a raster or a picture (in my case it was a raster from a raster field directly) and the Spatial Reference wasn't set for the layer or a map the raster ratio will give back 1, and it isn't so useful in the previous dividing formula. In this case you have to query the size of the mapcontrol, the size of the raster layer and use them in this relation formula:

map control width / raster width = wanted map scale / known, FULL extent map scale.

(If you want to use this later then you have to store the very first or the necessary raster full extent's scale! In the sample code below I didn't do that.)

from this:

wanted map scale = map control width / raster width * known, FULL extent map scale.

I hope these will help.

And the (C#) code cores are... 

 
1.:
//get MxDocumnet, cast (QI in VB), under VBA you can use it instantly
IMxDocument mxDoc = m_app.Document as IMxDocument;
//get the ActiveView
IActiveView pActiveView = mxDoc.ActiveView; //get the DisplayTransformation
IDisplayTransformation pDisplayTransformation = pActiveView.ScreenDisplay.DisplayTransformation;
//the scale of the map (the IMap::MapScale is a shortcut to this method)
double mapScale = pDisplayTransformation.ScaleRatio; //get the RasterOutputSettings, with a cast (QI in VB) from IDisplayTransformation
IRasterOutputSettings pRasterOutputSettings = pDisplayTransformation as IRasterOutputSettings;
//raster ratio, see the help for discussion of the ratio number
double rasterRatio = pRasterOutputSettings.RasterRatio; //the formula for the raster resolution
pDisplayTransformation.ScaleRatio = (mapScale / rasterRatio) //refreshing the map
pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null); 2.:
//get the Map
IMap pMap = m_HookHelper.FocusMap;
//get the raster layer, with cast (QI in VB) from ILayer, in my map it was the layer at 0 index
IRasterLayer pRasterLayer = pMap.get_Layer( 0 ) as IRasterLayer; //width of the MapControl control on the form
int controlWidth = pMapControl.Width;
//because in the formula, you have to use the width as an explicitly converted double number in C#
double controlW = Convert.ToDouble( controlWidth ); //the formula for the raster resolution
pMap.MapScale = (controlW / pRasterLayer.ColumnCount * pMap.MapScale) //get the ActiveView
IActiveView pActiveView = m_HookHelper.ActiveView;
//refreshing the map
pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null);

zoom to raster resolution的更多相关文章

  1. openlayers-热地图加载(完整版及代码)

    //地圖加載function mapInit(data){ //底图// var raster = new ol.layer.Tile({// source: new ol.source.Stamen ...

  2. 瓦片切图工具gdal2tiles.py改写为纯c++版本

    gdal2tiles.py是GDAL库中用于生成TMS瓦片的python代码,支持谷歌墨卡托EPSG:3857与经纬度EPSG:4326两种瓦片,输出png格式图像. gdal2tiles.py Mo ...

  3. 瓦片切图工具gdal2tiles.py改写为纯c++版本(二)

    python这么火,C++/C#的程序员都生存不下去了,为啥还要干把python转写成c++的这种反动的事? 项目需要呗... gdal2tiles.py文件中有两个类是计算全球墨卡托与WGS84两种 ...

  4. 巧用Openlayers4的Style

    原文:https://blog.csdn.net/gisshixisheng/article/details/80149087 概述 非常细化Openlayers4中的StyleFunction,因为 ...

  5. 完整版openlayer的例子及中文注释(完整中文版)

    //@sourceURL=PersonLocation.jsvar window_temp = { onbeforeunload: null, DEBUG_MODE: false, MAPLIST: ...

  6. Google Pixel 超分辨率--Super Resolution Zoom

    Google Pixel 超分辨率--Super Resolution Zoom Google 的Super Res Zoom技术,主要用于在zoom时增强画面细节以及提升在夜景下的效果. 文章的主要 ...

  7. yum install 安装 下载好的rpm包 会并依赖包一起安装 zoom电话会议的安装

    [root@ok-T Downloads]# rpm -ivh zoom_x86_64.rpm error: Failed dependencies: libxcb-image.so.()(64bit ...

  8. iphone dev 入门实例6:How To Use UIScrollView to Scroll and Zoom and Page

    http://www.raywenderlich.com/10518/how-to-use-uiscrollview-to-scroll-and-zoom-content Getting Starte ...

  9. RDCMan之DPI 和 Screen Resolution设置

    Customer要求在以下环境验证几个bug DPI setting Minimum   resolution 96 / 100% 1024x768 120 /125% 1280x960 144 / ...

随机推荐

  1. 原创:四种Linux系统开机启动项优命令超给力超详细详解

    老葵花哥哥又开课了 接下来是你们的齐天大圣孙悟空给你们带来的详细版Linux系统开机启动优化四种命令 第一种方法是很正常的 第二种有点难理解 第三种来自我的一个奇思妙想 本文档秉承 不要钱也不要臀部的 ...

  2. 常用的-->查找算法与排序算法

    顺序查找 从列表第一个元素开始,顺序进行搜索,直到找到为止. 二分查找 从有序列表的候选区data[0:n]开始,通过对待查找的值与候选区中间值的比较,可以使候选区减少一半. li = [1, 2, ...

  3. C++友元函数和运算符重载

    非成员友元函数.成员友元函数和友元类 1.友元的作用: (1)友元提供了不同类的成员函数之间.类的成员函数与一般函数之间进行了数据共享的机制: 2.友元的优点和缺点 优点:提高程序的运行效率: 缺点: ...

  4. C++ 给自己的扫盲笔记

    1.运算符new分配内存的格式: 指针变量名 = new 类型: 如分配一个20字节的name变量    :name = new char[20]; 2.strlen(s);函数: 返回字符串s的长度 ...

  5. 如何让线程A等待B执行结束后执行?

    1. 使用条件变量 判断是否任务B已经做完,然后再执行任务A. 测试代码可看:https://blog.csdn.net/guochao6531/article/details/78075882 2. ...

  6. UVa-401-Palindromes(回文)

    这一题的话我们可以把映像字符的内容给放入一个字符串常量里面,然后开辟一个二维的字符串常量数组,里面放置答案. 对于回文实际上是很好求的,对于镜像的话,我们写一个返回char的函数,让它接收一个char ...

  7. [CF] 402 E. Strictly Positive Matrix

    一个矩阵,自乘无限次后能否全为正数? 如果n比较小,可以二分一下,但是这里n很大,乘一次都无法接受 可以考虑实际含义:矩阵看成邻接矩阵,那么0就是没有边,其余就是有边. 我们知道邻接矩阵自乘k次就相当 ...

  8. SecureCRT 64位 破解版v8.1.4

    http://www.xue51.com/soft/1510.html#xzdz securecrt 破解版是一款支持SSH1和SSH2的终端仿真程序,这个程序能够在windows系统中登陆UNIX或 ...

  9. nginx 获取真实ip

    使用阿里云SLB,无法获取真实ip问题 官方给出的是如下用法,需要安装模块,大体上是没有错的,但是比较模糊,实际操作中可能会踩坑,所以参考学习即可,不必照搬.(那个http_realip_module ...

  10. Android 图片设置圆角

    Android中经常会遇到对图片进行二次处理,例如加圆角,或者显示圆形图片 方法一: 通过第三方框架Glide实现图片显示有圆角,有三种写法如下: 1.1,第一种实现: RequestOptions ...