uo_fileview_pic.sru 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. $PBExportHeader$uo_fileview_pic.sru
  2. forward
  3. global type uo_fileview_pic from uo_fileview
  4. end type
  5. type p_1 from picture within uo_fileview_pic
  6. end type
  7. end forward
  8. global type uo_fileview_pic from uo_fileview
  9. integer width = 2738
  10. integer height = 1680
  11. long ii_screenwidth = 49925880
  12. event resize pbm_size
  13. p_1 p_1
  14. end type
  15. global uo_fileview_pic uo_fileview_pic
  16. forward prototypes
  17. public function integer of_showfile (blob arg_data, string arg_filename, ref string arg_msg)
  18. public subroutine of_setfilesize ()
  19. end prototypes
  20. event resize;THIS.p_1.X = 0
  21. THIS.p_1.Y = 0
  22. IF NOT OriginalSize THEN
  23. THIS.p_1.Width = THIS.Width
  24. THIS.p_1.Height = THIS.Height
  25. END IF
  26. //this.of_setfilesize( )
  27. end event
  28. public function integer of_showfile (blob arg_data, string arg_filename, ref string arg_msg);Long rslt = 1
  29. cur_data = arg_data
  30. cur_filename = arg_Filename
  31. //of_setfilesize()
  32. RETURN rslt
  33. end function
  34. public subroutine of_setfilesize ();This.p_1.OriginalSize = OriginalSize
  35. //messagebox('','')
  36. This.HScrollBar = False
  37. This.VScrollBar = False
  38. IF IsNull(cur_data) THEN
  39. p_1.SetPicture(cur_data)
  40. RETURN
  41. END IF
  42. IF Len(cur_data) <= 0 THEN
  43. Blob nulldata
  44. SetNull(nulldata)
  45. p_1.SetPicture(nulldata)
  46. RETURN
  47. END IF
  48. p_1.PictureName = cur_Filename
  49. TRY
  50. blob filedata
  51. filedata =cur_data
  52. p_1.SetPicture(filedata)
  53. Catch(runtimeerror err)
  54. MessageBox('系统提示','获取文件失败,可能不支持该文件类型,~n'+err.Text)
  55. RETURN
  56. END TRY
  57. IF Not p_1.OriginalSize THEN
  58. This.HScrollBar = False
  59. This.VScrollBar = False
  60. This.p_1.Width = This.Width
  61. This.p_1.Height = This.Height
  62. p_1.X = 0
  63. p_1.Y = 0
  64. ELSE
  65. Long li_SW,li_SH
  66. Long li_x = 0,li_y = 0
  67. IF p_1.Width > This.Width THEN
  68. This.HScrollBar = True
  69. li_x = 0
  70. ELSE
  71. li_x = (This.Width - p_1.Width)/2
  72. END IF
  73. IF p_1.Height > This.Height THEN
  74. This.VScrollBar = True
  75. li_y = 0
  76. ELSE
  77. li_y = (This.Height - p_1.Height)/2
  78. END IF
  79. p_1.Move( li_x,li_y)
  80. END IF
  81. end subroutine
  82. on uo_fileview_pic.create
  83. int iCurrent
  84. call super::create
  85. this.p_1=create p_1
  86. iCurrent=UpperBound(this.Control)
  87. this.Control[iCurrent+1]=this.p_1
  88. end on
  89. on uo_fileview_pic.destroy
  90. call super::destroy
  91. destroy(this.p_1)
  92. end on
  93. type p_1 from picture within uo_fileview_pic
  94. integer width = 2359
  95. integer height = 1416
  96. boolean originalsize = true
  97. boolean focusrectangle = false
  98. end type