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