1.从本地读取图片文件,并判断格式是否附合要求。

FilenameFilter filter = [‘Image Files‘,‘*.bmp;*.jpg;*.gif;*.jpeg‘];

BinData binData = new BinData();

str extention, path, nameOfFile;

Container imageContainer ;

imageFilePathName = WinAPI::getOpenFileName(element.hWnd(),filter,‘‘, "@SYS53008", ‘‘,‘‘);

if (imageFilePathname && WinAPI::fileExists(imageFilePathName))

{

[path, nameOfFile, extention] = fileNameSplit(imageFilePathName);

if (extention == ‘.jpg‘)

{

binData.loadFile(imageFilePathName);

imageContainer = binData.getData();

}

else

{

throw error("@SYS89176");

}

}

2.将AX中的图片保存到本地文件夹

str path;

FilenameFilter filter = [‘Image Files‘,‘*.jpg‘];

CompanyImage companyImage;

Image image;

DialogBox dialogBox;

;

path = WinAPI::getSaveFileName(0,filter,‘‘,‘‘,‘‘,‘filename‘,0);

if(path)

{

image = new Image();

image.setData(companyImage.Image);

if(WinAPI::fileExists(path))

{

dialogBox = new DialogBox(DialogBoxType::YesNoBox,strfmt("@HPH243",path),‘‘,‘‘,DialogButton::Yes);

if(DialogButton::Yes == dialogBox.retval())

image.saveImage(path);

}

else

{

image.saveImage(path);

}

}

3.图片缩放显示在控件上。

image = new Image();

image.setData(imageContainer);

w = image.width()*sel/100;

h = image.height()*sel/100;

image.resize(w,h,InterpolationMode::InterpolationModeDefault);

Photo.image(image); //Photo为bitmap控件

4.图片的剪切,显示图片的控件窗口不能被其他窗口遮挡。

Container rect;

rect = WINAPI::getWindowRect(this.hWnd());//获取图片控件的屏幕坐标

int left,top;

left = conpeek(rect,1);

top = conpeek(rect,2);

image = new Image();

image.captureScreen(left,top,width,height);//根据坐标和大小进行剪切,该方法同样可以用来进行屏幕截图

5.导出图片到指定文件夹,适用于批量图片导出。

str path;

Image image;

str filename = "test.jpg";

image = new Image();

image.setData(imageContainer );

path = WinAPI::browseForPath(element.hWnd(),‘‘);

if(substr(path ,strlen(path)-1,1)!="\\")

path+="\\";//如果选择的桌面,则要加上\

path += filename;

image.saveImage(path);

附加: 获取用户选中的多条记录,以EmplTable为例:

for(emp=EmplTable_ds.getFirst(1) EmplTable_ds.getFirst(1):EmplTable_ds.cursor();emp;emp=EmplTable_ds.getNext())

{

//do something

}

Dynamics AX 中的图片处理

最新文章

  1. 基于mysql的数据管理
  2. Bzoj2957 楼房重建
  3. BFS 骑士的移动
  4. Makecert.exe(证书创建工具)
  5. Docker搭建MySQL服务
  6. JavaScript 要点(十四)HTML DOM 元素(节点)
  7. php内存管理
  8. 【Android 复习】:AndroidManifest.xml 文件详解
  9. wlan的QOS配置
  10. C++安装JSONCPP
  11. Oracle的几种索引
  12. 浙大pat1009题解
  13. LeetCode OJ 82. Remove Duplicates from Sorted List II
  14. 转:Java compiler level does not match the version of the installed Java project facet
  15. 字符编码笔记:ASCII,Unicode和UT…
  16. Win11曝光 代号“Core OS” 明年推出-IT外包
  17. Git----GitHub上传本地文件到git
  18. tomcat 7 启动报错:java.lang.NoSuchMethodError: javax.servlet.ServletContext.getSessionCookieConfig()Ljavax/servlet/SessionCookieConfig的解决
  19. Android上禁止屏幕旋转
  20. 关于引用外部类要用static 的问题

热门文章

  1. C# HtmlAgilityPack 爬虫框架
  2. EXPDP 时报错ORA-31693,ORA-02354,ORA-01555
  3. IntelliJ IDEA神器使用技巧 慕课
  4. 关于JWTtoken的管理问题
  5. mosquitto broker 安装服务后启动失败
  6. 在aspx中,如果要引用一个ID号,需要引用外层的ID号(内层的不行)
  7. 删除pending.xml
  8. random-----随机数
  9. CS通用项目系统搭建——三层架构第一天
  10. cordova/ionic打包流程