$PBExportHeader$w_fj_fileopen.srw forward global type w_fj_fileopen from window end type type cbx_originalsize from checkbox within w_fj_fileopen end type type cb_1 from uo_imflatbutton within w_fj_fileopen end type type cb_4 from uo_imflatbutton within w_fj_fileopen end type type ln_bar2 from line within w_fj_fileopen end type type ln_bar from line within w_fj_fileopen end type type r_bar from rectangle within w_fj_fileopen end type end forward global type w_fj_fileopen from window integer width = 2107 integer height = 1728 boolean titlebar = true string title = "文件查看" boolean controlmenu = true boolean minbox = true boolean maxbox = true windowtype windowtype = popup! windowstate windowstate = maximized! long backcolor = 67108864 string icon = "AppIcon!" boolean center = true cbx_originalsize cbx_originalsize cb_1 cb_1 cb_4 cb_4 ln_bar2 ln_bar2 ln_bar ln_bar r_bar r_bar end type global w_fj_fileopen w_fj_fileopen type variables long ins_fileID //当前单据类型 string ins_filetype Transaction Transaction_pic // Blob ins_lbimage string ins_ori_title uo_fileview obj_fileview end variables forward prototypes public subroutine wf_set_object_size () public subroutine wf_resize () public function long wf_fileopen (long arg_fileid) end prototypes public subroutine wf_set_object_size ();IF IsValid(obj_fileview) THEN obj_fileview.Y = ln_bar2.endY + 10 obj_fileview.Height = this.Height - obj_fileview.Y - 40 obj_fileview.X = 10 obj_fileview.Width = THIS.Width - obj_fileview.X -40 obj_fileview.of_set_originalsize( cbx_originalsize.checked) obj_fileview.of_setfilesize( ) END IF end subroutine public subroutine wf_resize ();//if not p_1.originalsize then // p_1.x = dw_file_index.x + dw_file_index.width // p_1.height = dw_file_index.height // p_1.y = dw_file_index.y // p_1.width = THIS.Width - dw_file_index.x - dw_file_index.width // THIS.HScrollBar = FALSE // THIS.VScrollBar = FALSE // return //end if //Integer li_SW,li_SH //Integer li_x = 1,li_y = 1 // //IF p_1.Width > THIS.Width - dw_file_index.x - dw_file_index.width OR p_1.Height > THIS.Height - dw_file_index.y THEN // THIS.HScrollBar = TRUE // THIS.VScrollBar = TRUE // li_x=dw_file_index.x + dw_file_index.width // li_y=dw_file_index.y //ELSE // THIS.HScrollBar = FALSE // THIS.VScrollBar = FALSE // // //当前的窗口对象无效则返回 // // //获取屏幕的宽度和高度 // //if GetEnvironment(lenv)=-1 then return -1 // li_SW = THIS.Width - dw_file_index.x - dw_file_index.width // li_SH = THIS.Height - dw_file_index.y // // //得到中心位置的坐标 // //if li_SW>ole.Width then // li_x = (li_SW - p_1.Width)/2 + dw_file_index.x + dw_file_index.width // //end if // //if li_SH>ole.Height then // li_y = (li_SH - p_1.Height)/2 + dw_file_index.y // //end if // // //移动窗口到屏幕中心 // // //ole.x = li_x // //ole.y = li_y // //END IF // //p_1.Move(li_x,li_y) // // end subroutine public function long wf_fileopen (long arg_fileid);s_fileinfo s_file String arg_msg Blob nulldata SetNull(nulldata) String ls_filetype,ls_filename SELECT filetype,filename INTO :ls_filetype,:ls_filename FROM u_file Where fileid = :arg_fileid USING Transaction_pic; IF Transaction_pic.SQLCode <> 0 THEN IF IsValid(obj_fileview) THEN CloseUserObject(obj_fileview) END IF MessageBox('错误','获取文件类型失败'+Transaction_pic.SQLErrText,stopsign!,OK!) RETURN 0 END IF THIS.Title = ins_ori_title +' ['+Trim(ls_filetype)+'] '+Trim(ls_filename) SELECTBLOB filedata INTO :s_file.filedata FROM u_file Where fileid = :arg_fileid USING Transaction_pic; IF Transaction_pic.SQLCode <> 0 THEN IF IsValid(obj_fileview) THEN CloseUserObject(obj_fileview) END IF MessageBox('错误','获取图片失败'+Transaction_pic.SQLErrText,stopsign!,OK!) RETURN 0 END IF IF NOT IsValid(obj_fileview) THEN obj_fileview = CREATE uo_fileview_pic OpenUserObject(obj_fileview) END IF obj_fileview.OriginalSize = cbx_originalsize.Checked IF obj_fileview.of_showfile( s_file.filedata,ls_filename, arg_msg) <> 1 THEN IF IsValid(obj_fileview) THEN CloseUserObject(obj_fileview) END IF MessageBox('错误',arg_msg,stopsign!,OK!) RETURN 0 END IF RETURN 1 end function on w_fj_fileopen.create this.cbx_originalsize=create cbx_originalsize this.cb_1=create cb_1 this.cb_4=create cb_4 this.ln_bar2=create ln_bar2 this.ln_bar=create ln_bar this.r_bar=create r_bar this.Control[]={this.cbx_originalsize,& this.cb_1,& this.cb_4,& this.ln_bar2,& this.ln_bar,& this.r_bar} end on on w_fj_fileopen.destroy destroy(this.cbx_originalsize) destroy(this.cb_1) destroy(this.cb_4) destroy(this.ln_bar2) destroy(this.ln_bar) destroy(this.r_bar) end on event resize;ln_bar.EndX = THIS.Width ln_bar2.EndX = THIS.Width r_bar.Width = THIS.Width wf_set_object_size() end event event open;s_edit_index_tran s_tran //翻页功能窗口 传递参数使用 s_tran = Message.PowerObjectParm IF NOT IsNull(s_tran.sqltransaction ) THEN Transaction_pic = s_tran.sqltransaction ELSE MessageBox('提示','没有数据库事务',information!,OK!) Close(THIS) RETURN END IF IF NOT IsNull(s_tran.f_long) THEN ins_fileid = s_tran.f_long ELSE ins_fileid = 0 MessageBox('提示','不合理文件唯一码',information!,OK!) Close(THIS) RETURN END IF ins_ori_title= this.title wf_fileopen(ins_fileid) //IF NOT IsNull(s_tran.g_long ) THEN // ins_relid = s_tran.g_long //ELSE // ins_relid = 0 //END IF //IF NOT IsNull(s_tran.f_string ) THEN // ins_relcode = s_tran.f_string //ELSE // ins_relcode = '' //END IF // //ins_ds_fileclass = create datastore //ins_ds_fileclass.dataobject=dw_fileclass.dataobject //ins_ds_fileclass.SetTransObject(sqlca) // ////dw_fileclass.SetTransObject(sqlca) //dw_fj.SetTransObject(Transaction_pic) // //THIS.TriggerEvent('retrieve_fileclass') // // end event type cbx_originalsize from checkbox within w_fj_fileopen integer x = 366 integer y = 56 integer width = 334 integer height = 48 boolean bringtotop = true integer textsize = -9 integer weight = 400 fontcharset fontcharset = gb2312charset! fontpitch fontpitch = variable! string facename = "宋体" long textcolor = 33554432 long backcolor = 134217738 string text = "原始大小" boolean checked = true end type event clicked;IF IsValid(obj_fileview) THEN obj_fileview.of_set_originalsize( THIS.Checked) END IF IF THIS.Checked THEN f_SetProfileString (sys_empid, "w_fj_fileopen", "originalsize", '1') ELSE f_SetProfileString (sys_empid, "w_fj_fileopen", "originalsize", '0') END IF end event event constructor;THIS.BackColor = 14215660 String OriginalSize OriginalSize = f_ProfileString (sys_empid, "w_filemanager", "originalsize", "1") IF OriginalSize = '1' THEN THIS.Checked = TRUE ELSE THIS.Checked = FALSE END IF end event type cb_1 from uo_imflatbutton within w_fj_fileopen integer x = 151 integer width = 151 integer height = 164 integer taborder = 10 string text = "刷新" string normalpicname = "refresh.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;wf_fileopen(ins_fileid) wf_set_object_size() end event type cb_4 from uo_imflatbutton within w_fj_fileopen integer width = 151 integer height = 164 integer taborder = 60 string text = "退出" string normalpicname = "exit.bmp" integer picsize = 16 toolbaralignment pic_align = alignattop! boolean border = false end type event clicked;call super::clicked;close(parent) end event type ln_bar2 from line within w_fj_fileopen long linecolor = 16777215 integer linethickness = 4 integer beginx = -23 integer beginy = 176 integer endx = 2016 integer endy = 176 end type type ln_bar from line within w_fj_fileopen long linecolor = 268435456 integer linethickness = 4 integer beginx = -23 integer beginy = 172 integer endx = 1984 integer endy = 172 end type type r_bar from rectangle within w_fj_fileopen long linecolor = 16777215 integer linethickness = 4 long fillcolor = 1073741824 integer x = 937 integer y = 12 integer width = 146 integer height = 68 end type event constructor;this.fillcolor = 14215660 this.linecolor = 14215660 this.x = -1 this.y = -1 this.height = ln_bar.beginy - 5 end event