外文翻译在PowerBuilder中处理图片文件的方法研究.docx
- 文档编号:26105250
- 上传时间:2023-06-17
- 格式:DOCX
- 页数:14
- 大小:105.50KB
外文翻译在PowerBuilder中处理图片文件的方法研究.docx
《外文翻译在PowerBuilder中处理图片文件的方法研究.docx》由会员分享,可在线阅读,更多相关《外文翻译在PowerBuilder中处理图片文件的方法研究.docx(14页珍藏版)》请在冰豆网上搜索。
外文翻译在PowerBuilder中处理图片文件的方法研究
中文2696字
出处:
ComputerScienceandInformationTechnology,2009.ICCSIT2009.2ndIEEEInternationalConferenceon.IEEE,2009:
405-407
翻译部分
英文原文
StudyonmethodofpicturefilesprocessinginPowerBuilder
JiaYinjiangZhangTiejunZhaoJunying
Abstract—Picturesareoneoftheimportantelementsofwhichtheapplicationiscomposed.Aprogrammerisabletochoosesuitabletreatmentaccordingtothesystemrequirement.InPowerBuilderpicturecontrolandolecontrolarethemostcommonly-usedmethods;blobdatatypefieldisusedtoaccesspicturefilesindatabaseandfunctionofdatawindowisusedtodisplaypicturesdynamically.Eachmethodhasitsowncharacteristicsandapplicationconditions.ThisarticlediscussesandexploresthemethodsofstorageanddisplayofpicturefilesinPowerBuilder.
Keywords:
BlobDataType;PictureControl;Picture
Processing
I.INTRODUCTION
Picturesarecomposedofanimportantelementintheapplication.Flexibilityintheuseofthepicturewillmaketheproceduremoreattractive.Methodofpicturefilesprocessingmainlyincludespicturestorage,displayandupdate,etc.PowerBuilderinaccessthedatabaseanddataprocessinghasaverystrongfunctionbutweakinpicturestorageanddisplay.Aslongaswemastersomecommonly-useddevelopmentskills,wewillbeabletosolvepictureprocessingproblemwellinthepracticalapplication.
Picturesstoredintheformoffilecanbedisplayedwithpicturecontrolorolecontrol;picturesstoredinthedatabase,ablobdatatypefieldneededtobedefinedandpicturedatais
operatedwithbinarylargeobjectcommand.Inadditiontotheabovetwomethods,picturesalsocanbedisplayed
dynamicallybyusingofthemodifyfunctionofdatawindow.Eachmethodhasitsowncharacteristicsandapplication
conditions.ThisarticlediscussesandexploresthemethodsofstorageanddisplayofpicturefilesinPowerBuilder.
II.DISPLAYOFPICTUREFILES
A.PictureDisplaybyUseofPictureControl
InPowerBuilderusingpicturecontroliscommonmethodtodisplaythepicture.Itsupportsthepictureofthetypes
includeBMP,JPG,GIF,RLE,WMF,etc.Thefollowingmethodscanbeusedtodisplaypictures:
First,placeapicture
controlinthewindowandspecifytheselectedpicturebysettingits"picturename"staticproperty.Second,displaya
picturebysettingitspropertyinthescript,forexample,thescriptdisplayingpicturefile“jack.jpg”underthespecified
pathisp_1.picturename=”d:
\student\pic\jack.jpg”.Theabovetwomethodsareusedtodisplaytheabsolutepathof
thepictureways,thedisadvantageisthatpicturesmaynotbeabletodisplaycorrectlybecauseofthepathproblemafter
systemmigration.Third,displaypicturesbysettingrelativepathtosolvetheproblemoftheabsolutepath,modifyscript
codeforthep_1.picturename=”.\pic\jack.jpg”,weshouldpayattentiontothedifferencebetweenthetwomethods,thus,
pictureswillnotbedisappearedaftersystemmigration.
B.PictureDisplaybyUseofOleControl
Oleistheabbreviationofobjectlinkingandembeddingandrealizethroughremotecall,itisusedtotransferinformationfromoneapplicationtoanotheratacomputer.Olecontrolisthecontainerofcarryingoleobject.Displayingpictureswitholecontrol,firstplaceanolecontrolinPBwindow,andthenchoosepaintbrushpictureorbitmapimagetoshowthepictureoftheobjecttype,finallypicturescanbedisplayedwiththescriptaddedtotheprogram,suchasthefollowingstatementachievetoinsertanoleobjectnamed“peter”bitmapimage.ole_1.insertfile(“d:
\student\pic\peter.bmp”)
C.PictureDisplaybyUseFunctionofDataWindowModifyfunctionisaveryimportantfunctionofdatawindow,itismostfrequentlyfunctionusedwhileoperatingdatawindow.Thebasicsyntaxisasfollowing:
dw_controlname.modify(stringmodstring)Parametersmodstringdefinesmodificationofproperty.Userscanusetocreate,delete,andsetthepropertyvalueofthreetypesofstatementtodynamicallymodify.Forexample,placeadatawindowcontrolandacommandbuttonnamedchoosepicture,createadatawindowobjectandbindingadatawindowcontrol,inopeneventofthewindowenterthescriptcodeisasfollowing:
dw_1.settransobject(sqlca)
dw_1.retrieve()
Scriptcodeinclickedeventofthecommandbuttonisasfollowing:
stringls_string,ls_fn
stringls_filepath,ls_filename
getfileopenname("pleasechoosethepicturefiles",ls_filepath,ls_filename,"bmp","bmpfiles(*.bmp),*.bmp,jpgfiles(*.jpg),*.jpg,allfiles(*.*),*.*")
ls_fn=ls_filepath
ls_string='createbitmap(band=detailx="800"y="10"width="500"height="470"ls_filename="'+ls_fn+'"border="2"name=ls_pn)'
dw_1.modify(ls_string)
Runwindowandclickthecommandbutton,chooseapictureinthepop-updialogbox,theselectedpicturewillbedisplayedindetailbandofdatawindow,positionisx=800andy=10,picturesizeis500multiplied470pixels,borderstyleis2,thatis“stylebox”type.
Thismethodhasthefollowingcharacteristicsincomparisonwitholecontrolandpicturecontrolstyle:
First,datawindowfunctionscansupportmorefiletypeanddisplayavarietyoffiletypeformats,includingBMP,JPG,GIF,WMFImagefileformat,etc.Second,datawindowfunctionshavethecharacteristicsofflexibility,freedom,andcanbesetupinfunctionofpictureposition,size,border,displayarea,andotherproperty.Third,fasterimagesandlessmemory,picturesdisplayarenotplacedtosetacontrol,butdynamicallygeneratedintheprocessofprogramrunning.
III.PICTUREFILESACCESSINDATABASE
A.AccessPicturesthroughtheFilePath
Inordertoillustratetheoperationofpicturefiles,heretwotablesandtheirstructuredefinedaregivenbelow:
TABLEI.TABLETPB
ColumnNameDataTypeWidthNullRemark
Tpbhvarchar20NoPrimaryKey
tpljvarchar50Yes
TABLEII.TABLESTUDENT
ColumnNameDataTypeWidthNullRemark
xhvarchar10NoPrimaryKey
xmvarchar8No
xbvarchar2No
csrqdateYes
zplongbinaryYes
Inthisway,acharorvarchardatatypefieldwillbedefinedinthedatabase.Thisfieldisusedtoaccesstheimagefilepathandnameinsteadoftheimagefile,picturefilesstoredindisk.Ifapicturestoredinthepathspecialwillbedisplayed,wecanusepicturecontrolordatawindowtorealize.Picturesarenotstoredinthedatabase,thedatabasewillnotturnbigandthepicturewillbedisplayedmorequickly.
1)Picturecontrolmode
Placeapicturecontrolinthewindow,displaypicturesstoredinthepathofpictureasrunningwindow.Thescriptofwindowinitsopeneventisasfollowing:
stringls_path//storagepath
selecttpljinto:
ls_pathfromtpwheretpbh='20090310';//fieldtpljsavestoragepathofthepicturep_1.picturename=ls_path//displaypicture
2)Datawindowmode
Selectallthefieldsfromtpbtableandcreatefreeformstyledatawindowobject.Selectdisplayaspicturepropertyoftpljfieldingeneraltabofdatawindow,whichisthekeytobeabletoshowthepicture.Createadatawindowobjectandbindingadatawindowcontrol,inopeneventofthewindowenterthescriptcodeisasfollowing:
dw_1.settransobject(sqlca)
dw_1.retrieve()
Thus,tpljfieldwillshowthepictureratherthanthestoragepathasprogramrunning.
B.AccessPicturesbyUseofTableField
Inrealapplication,thepictureisoftennecessarystoredinthedatabasetodeal.Asforthepicturetypesofdataarenotdirectlyoperateinthebackgrounddatabase,onlyintheprocedureadoptedbythecorrespondingcommandtoachieve.Backgrounddatabaseadaptiveserveranywheredatabaseasanexample,fieldtypestoredpicturesmustbedefinedaslongbinaryorlongvarchar,thatis,blobdata,andthefieldofnullvalueofpropertymustbesettoyes,otherwisethepicturewillnotbeabletostoreinthedatabase.
ThedirectuseofSQLstatementsintheupdateandselectcommandsareunabletooperateblobdatastoredindatabase.PowerBuilderprovidestwooperationcommandsforblobdata:
selectblobstatementandupdateblobstatement.
Selectblobstatementisusedtoreadblobdataanditsbasicsyntaxruleis:
selectblobrestofselectstatement{usingtransactionobject};
Updateblobstatementisusedtoupdateblobdataanditsbasicsyntaxruleis:
updateblobtablename
setblobcolumn=blobvariable
restofselectstatement{usingtransactionobject};
Now,entryinformationtostudentsasanexampletoshowhowtheblobdatastoredinthedatabase.
1)Createfreeformstyledatawindowobject,selectallthedatafieldsofstudentinformationtable.Note,blobfieldcan'tbeshown,ofcourse,itcan'tbeselected.
2)Insertthedatabasebinary/textlargeobjectcontrolintothedatawindowandsetthecorrespondingoptionsparameters,asshowninfigure1.
Figure1.BlobFieldPropertySettings
3)Insertacommandbuttoncontrolinthedatawindow,settextpropertyasselectpictureandsetnamepropertyascb_select,adjustthedatawindowlayout,finishthedatawindowobjectcreation.
4)Createanewwindowobject,placeadatawindowcontrolandbindthejustcreateddatawindowobject.Placethreebuttonscontrol,onepicturecontrolandoneolecontrol,setvisiblepropertyofolecontroltofalse.Apicturecontrolandanolecontrolwereplacedsimultaneouslybecauseolecontrolcan'tdisplayJPG,GIFandothertypeofpicture,butdisplayfilepathonly.Thoughpicturecontrolcandisplaythesetypesofpicture,butcan'tgetthepicturestorage.So,usingpicturecontroltoshowpictureandolecontroltostorepicture.
5)Themainscriptofdatawindowinitsclickedeventisasfollowing:
longll_row
ifdwo.name="cb_select"then
ll_row=dw_1.getrow()
stringfilepath,filename//storagepathandnameofthepicture
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 外文 翻译 PowerBuilder 处理 图片 文件 方法 研究