uo_piclistview.sru 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. $PBExportHeader$uo_piclistview.sru
  2. forward
  3. global type uo_piclistview from listview
  4. end type
  5. end forward
  6. global type uo_piclistview from listview
  7. integer width = 1943
  8. integer height = 1288
  9. integer textsize = -9
  10. integer weight = 400
  11. fontcharset fontcharset = gb2312charset!
  12. fontpitch fontpitch = variable!
  13. string facename = "宋体"
  14. long textcolor = 33554432
  15. borderstyle borderstyle = stylelowered!
  16. boolean autoarrange = true
  17. boolean extendedselect = true
  18. boolean fixedlocations = true
  19. boolean gridlines = true
  20. long largepicturemaskcolor = 536870912
  21. long smallpicturemaskcolor = 536870912
  22. long statepicturemaskcolor = 536870912
  23. end type
  24. global uo_piclistview uo_piclistview
  25. type variables
  26. private:
  27. string PictureName[]
  28. end variables
  29. forward prototypes
  30. public subroutine uf_clear ()
  31. public subroutine uf_setsize (long arg_width, long arg_height)
  32. public function integer uf_getitems (ref s_piclistview_parm arg_s_pics[], ref string arg_msg)
  33. public function integer uf_additem (s_piclistview_parm arg_parm, ref string arg_msg)
  34. end prototypes
  35. public subroutine uf_clear ();This.DeleteItems()
  36. This.DeleteLargePictures()
  37. end subroutine
  38. public subroutine uf_setsize (long arg_width, long arg_height);This.LargePictureWidth = arg_width
  39. This.LargePictureHeight = arg_height
  40. end subroutine
  41. public function integer uf_getitems (ref s_piclistview_parm arg_s_pics[], ref string arg_msg);Int rslt = 1
  42. Long cnt
  43. cnt = UpperBound(arg_s_pics)
  44. Long i
  45. listviewitem lvi
  46. String ls_path
  47. FOR i = 1 To This.TotalItems()
  48. IF This.GetItem(i, lvi) <> 1 THEN
  49. rslt = 0
  50. arg_msg = 'getitem失败'
  51. GOTO ext
  52. END IF
  53. ls_path = This.PictureName[lvi.PictureIndex]
  54. cnt++
  55. arg_s_pics[cnt].Label = lvi.Label
  56. arg_s_pics[cnt].tmppath = ls_path
  57. arg_s_pics[cnt].a_any = lvi.Data
  58. IF f_filetoblob(ls_path, arg_s_pics[cnt].Data, arg_msg) <> 1 THEN
  59. rslt = 0
  60. GOTO ext
  61. END IF
  62. NEXT
  63. ext:
  64. RETURN rslt
  65. end function
  66. public function integer uf_additem (s_piclistview_parm arg_parm, ref string arg_msg);Int rslt = 1
  67. ListViewItem lvi
  68. Boolean lb_FileExists = False
  69. IF FileExists(arg_parm.tmppath) THEN
  70. lb_FileExists = True
  71. IF Not IsNull(arg_parm.Data) And Len(arg_parm.Data) > 0 THEN
  72. IF FileDelete(arg_parm.tmppath) THEN
  73. lb_FileExists = False
  74. END IF
  75. END IF
  76. END IF
  77. IF Not lb_FileExists THEN
  78. IF f_blobtofile(arg_parm.tmppath, arg_parm.Data, arg_msg) <> 1 THEN
  79. rslt = 0
  80. GOTO ext
  81. END IF
  82. END IF
  83. Long i
  84. i = This.AddLargePicture(arg_parm.tmppath)
  85. IF i <= 0 THEN
  86. rslt = 0
  87. arg_msg = '控件添加图片失败'
  88. GOTO ext
  89. END IF
  90. PictureName[i] = arg_parm.tmppath
  91. lvi.PictureIndex = i
  92. lvi.Label = arg_parm.Label
  93. lvi.Data = arg_parm.a_any
  94. This.AddItem(lvi)
  95. GOTO ext
  96. ext:
  97. RETURN rslt
  98. end function
  99. on uo_piclistview.create
  100. end on
  101. on uo_piclistview.destroy
  102. end on