内存不足,在安装了12GB的Windows 7 64位系统中显示缩略图 [英] Out of Memory displaying Thumbnails in Windows 7 64-Bit with 12GB installed

查看:110
本文介绍了内存不足,在安装了12GB的Windows 7 64位系统中显示缩略图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

''我的VB代码:

''My VB Code:

Private Sub Thumb()
        Dim img As Image
        img = Image.FromFile(F$)'F$ = HiRes 1-7MByte.jpg Canon camera Pic File type .jpg
        imgThumb = img.GetThumbnailImage(51, 57, Nothing, New IntPtr())
        img.Dispose()
    End Sub
    
Private Sub DisplayPanelOf100Thumbnails()
    Dim J As Integer 'Public F$ has been previously declared in Module1
    For J = 1 To 100 'PB1 .. PB100 are PictureBoxes Size(51,57) on a Form GroupBox
      F$ = ListAddFiles.items(J)'ListAddFiles is a ListBox filled with picture
          'file names that were selected by the user from OpenFileDialog1       
      If J = 1 Then
        Thumb()
        PB1.Image = imgThumb : imgThumb.Dispose()
        PB1.SizeMode = PictureBoxSizeMode.StretchImage
      '.
      'loop continues for PicturePoxes PB1 through PB100
      '.
      Else If J = 100 Then 
        Thumb()
        PB100.Image = imgThumb : imgThumb.Dispose()
        PB100.SizeMode = PictureBoxSizeMode.StretchImage
      End If
    Next J
End Sub



''问题1:
''如果.jpg图片文件小于300KB那么这段代码就可以正常工作而不会引发任何异常.

''但是如果.jpg文件是文件大小大于1MB的高分辨率.jpg图像,我会得到一个
''内存不足异常持续约第36个-40个PictureBox正在使用缩略图进行更新.
``问题不在于图片文件,每个文件都将单独加载到
缩略图缩略图框,如果它们是较小的
中的唯一一个或成员 ''从OpenFileDialog1控件中选择的组
''此问题发生于以下目标计算机:Windows 7 Ultimate 64Bit SP2 with''已安装12GB RAM且安装了具有8核,3GB DDR5 NVIDIA图形的I7 970处理器
''在PC上不会发生此问题:Windows XP Prof SP3 32Bit 4GB RAM AMD6000 +
''具有NVidia 520 PCix显卡1GB的双核处理器

''问题2:
"在XP系统上,更新Thumbnail PictureBox大约需要0.5秒,而"100个大拇指的全面板显示大约需要50秒...太长了!!!"如果是Win7系统
''不会崩溃,大文件可能需要几秒钟才能填满100个图片框

''问题3:''如果我在Thumb()中更改缩略图的大小,它确实会
``似乎没有改变显示的图片或显示拇指的速度.
''IE. imgThumb = img.GetThumbnailImage(4,4,Nothing,New IntPtr())似乎给了
相同的结果和性能..
无法显示4 x 4的图片大小 ''我的视觉判断..看起来相当复杂而清晰

"问题4:如果用户在XP PC系统上选择了大约1500个以上的文件,则
" FileDialog1给出了错误的"File BlaBha",该名称不存在.如果我选择任何一个.
''目标目录中的图片文件,或者如果我选择任意数量的图片文件
少于大约1500个文件,这没有问题.用
返回的文件名 不存在"异常不是选择目录中的文件名.

''问题5:
''如果用户尝试选择更多
超过1500个文件名可供查看,然后
``OpenFileDialog1在XP上进入乌龟速度模式.这发生在
"单击OpenFileDialog1中的选择过程...而不是在单击确定"按钮之后.

问题6:如果Windows 7系统用户尝试选择要添加的5000个以上文件",则OpenFileDialog1选择过程开始变慢,
"在用户选择文件时的速度......在将这些文件名添加到ListAddFiles列表框之前,

''关于这种显示速度的问题有帮助吗?
''关于缩略图的任何帮助都会显示代码内存不足问题?
''有关OpenFileDialog1"Turtle-Mode"的任何帮助大量选定的问题?



''Issue #1:
''If the .jpg picture files are <300KB approx. then this code works fine without ''throwing any exception.

''But if the .jpg files are Hi-Res .jpg images with file sizes >1MB I get an
''Out Of Memory Exception consistently at approx. the 36th -40th PictureBox being updated with a thumbnail.
''The problem is not with the picture files, each will individually load into
''a Thumbnail PictureBox if they are the only one or a member of a smaller
''group selected from the OpenFileDialog1 control
''This problem occurs with: target PC: Windows 7 Ultimate 64Bit SP2 with ''12GByte RAM installed I7 970 processor with 8-Cores, 3GB DDR5 NVIDIA graphics
''This problem does not occur on a PC: Windows XP Prof SP3 32Bit 4GB RAM AMD6000+
''Dual-Core Processor with NVidia 520 PCix graphics 1GB

''Issue #2:
''Updating a Thumbnail PictureBox takes about .5 second on the XP system and the ''full panel of 100 Thumbs takes about 50Sec...much too long!!! If the Win7 system
''does not crash, large files can take several seconds to fill 100 Pictureboxes

''Issue #3: ''If I change the size of the Thumbnail in Thumb() it does
''not seem to change the displayed picture or the speed of displaying thumbs.
''i.e. imgThumb = img.GetThumbnailImage(4,4, Nothing, New IntPtr()) seems to give
''the same results and performance ..a picture size of 4 by 4 is not displayed by
''my visual judgement..it seems quite complex and clear

''Issue #4: If the user selects more than approx 1500 files on the XP PC system, the
''FileDialog1 gives a false "File BlaBha " does not exist. If I select any indiv.
''Picture file in the target directory, or if I select any number of picture files
''less than approx 1500 files, there is no problem. The filename returned with the
''"Does Not Exist" exception is not a filename in the selection directory.

''Issue #5:
''If the user tries to select more
''than 1500 file names to be candidates for viewing, then the
''OpenFileDialog1 goes into turtle-speed mode on the XP. This occurs during the
''selection process in the OpenFileDialog1...not after the "OK" button is has been ''clicked.

''Issue #6: If the Windows 7 systems user attempts to select more than 5000 files ''to be added for viewing, the OpenFileDialog1 selection process starts to slow to
''turtle speed while the user is selecting files...before these file names are ''added to the ListAddFiles listbox,

'' Any Help on this speed of display problem?
'' Any Help on the Thumbnail display code Out Of Memory Problem?
'' Any Help on the OpenFileDialog1 "Turtle-Mode" Large number of selected problem?

推荐答案

)' F
)'F


= HiRes 1-7MByte.jpg佳能相机Pic文件类型.jpg imgThumb = img.GetThumbnailImage( 51 57 没什么新建 IntPtr ()) img.Dispose() 结束 私有 DisplayPanelOf100Thumbnails() Dim J As 整数 ' 公共F
= HiRes 1-7MByte.jpg Canon camera Pic File type .jpg imgThumb = img.GetThumbnailImage(51, 57, Nothing, New IntPtr()) img.Dispose() End Sub Private Sub DisplayPanelOf100Thumbnails() Dim J As Integer 'Public F


先前已在Module1中声明 对于 J = 1 收件人 100 ' PB1 .. PB100是PictureBoxes Size(51,57)on表单GroupBox F
has been previously declared in Module1 For J = 1 To 100 'PB1 .. PB100 are PictureBoxes Size(51,57) on a Form GroupBox F


这篇关于内存不足,在安装了12GB的Windows 7 64位系统中显示缩略图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆