1、PDF外文:http:/ 2696 字 出处: Computer Science and Information Technology, 2009. ICCSIT 2009. 2nd IEEE International Conference on. IEEE, 2009: 405-407 翻译部分 英文原文 Study on method of picture files processing in PowerBuilder Jia Yinjiang Zhang Tiejun Zhao Junying Abstract Pictures are one o
2、f the important elements of which the application is composed. A programmer is able to choose suitable treatment according to the system requirement. In PowerBuilder picture control and ole control are the most commonly-used methods; blob data type field is used to access picture files in database a
3、nd function of data window is used to display pictures dynamically. Each method has its own characteristics and application conditions. This article discusses and explores the methods of storage and display of picture files in PowerBuilder. Keywords: Blob Data Type; Picture Control; Picture Pr
4、ocessing I. INTRODUCTION Pictures are composed of an important element in the application. Flexibility in the use of the picture will make the procedure more attractive. Method of picture files processing mainly includes picture storage, display and update, etc. PowerBuilder in access the database a
5、nd data processing has a very strong function but weak in picture storage and display. As long as we master some commonly-used development skills, we will be able to solve picture processing problem well in the practical application. Pictures stored in the form of file can be displayed with pi
6、cture control or ole control; pictures stored in the database,a blob data type field needed to be defined and picture data is operated with binary large object command. In addition to the above two methods, pictures also can be displayed dynamically by using of the modify function of data window.Eac
7、h method has its own characteristics and application conditions. This article discusses and explores the methods of storage and display of picture files in PowerBuilder. II. DISPLAY OF PICTURE FILES A. Picture Display by Use of Picture Control In PowerBuilder using picture control is common method t
8、o display the picture. It supports the picture of the types include BMP, JPG, GIF, RLE, WMF, etc. The following methods can be used to display pictures: First, place a picture control in the window and specify the selected picture by setting its "picture name" static property. Second, disp
9、lay a picture by setting its property in the script, for example, the script displaying picture file “jack.jpg” under the specified path is p_1.picturename=”d:studentpicjack.jpg”. The above two methods are used to display the absolute path of the picture ways, the disadvantage is that pictures may n
10、ot be able to display correctly because of the path problem after system migration. Third, display pictures by setting relative path to solve the problem of the absolute path, modify script code for the p_1.picturename=”.picjack.jpg”, we should pay attention to the difference between the two methods
11、, thus, pictures will not be disappeared after system migration. B. Picture Display by Use of Ole Control Ole is the abbreviation of object linking and embedding and realize through remote call, it is used to transferinformation from one application to another at a computer.Ole control is the contai
12、ner of carrying ole object. Displaying pictures with ole control, first place an ole control in PB window, and then choose paintbrush picture or bitmap imageto show the picture of the object type, finally pictures can bedisplayed with the script added to the program, such as the following statement
13、achieve to insert an ole object named“peter” bitmap image.ole_1.insertfile(“d:studentpicpeter.bmp”) C. Picture Display by Use Function of Data Window Modify function is a very important function of data window, it is most frequently function used while operating data window. The basic syntax is as f
14、ollowing: dw_controlname.modify(string modstring) Parameters modstring defines modification of property.Users can use to create, delete, and set the property value of three types of statement to dynamically modify. For example,place a data window control and a command button named choose picture, cr
15、eate a data window object and binding a data window control, in open event of the window enter the script code is as following: dw_1.settransobject(sqlca) dw_1.retrieve() Script code in clicked event of the command button is as following: string ls_string,ls_fn string ls_filepath,ls_filename getfile
16、openname("please choose the picture files",ls_filepath,ls_filename,"bmp","bmp files(*.bmp),*.bmp,jpg files(*.jpg),*.jpg,all files (*.*),*.*" ) ls_fn=ls_filepath ls_string='create bitmap(band=detail x="800" y="10" width="500" height=&quo
17、t;470" ls_filename="'+ls_fn+' " border="2" name=ls_pn)' dw_1.modify(ls_string) Run window and click the command button, choose a picture in the pop-up dialog box, the selected picture will be displayed in detail band of data window, position is x=800
18、and y=10, picture size is 500 multiplied 470 pixels, border style is 2, that is “stylebox” type. This method has the following characteristics in comparison with ole control and picture control style: First, data window functions can support more file type and display a variety of file type formats,
19、 including BMP, JPG,GIF, WMF Image file format, etc. Second, data window functions have the characteristics of flexibility, freedom, and can be set up in function of picture position, size, border, display area, and other property. Third, faster images and less memory, pictures display are not place
20、d to set a control, but dynamically generated in the process of program running. III. PICTURE FILES ACCESS IN DATABASE A. Access Pictures through the File Path In order to illustrate the operation of picture files, here two tables and their structure defined are given below: TABLEI. TABLE TPB
21、Column Name Data Type Width Null Remark Tpbh varchar 20 No Primary Key tplj varchar 50 Yes TABLE II. TABLE STUDENT Column Name Data
22、Type Width Null Remark xh varchar 10 No Primary Key xm varchar 8 No xb varchar 2 No csrq date Yes zp long binary Yes