473,396 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

ImageList - Memory-Issue in vs2005

Hi,

We have been using ImageLists in our Projects extensively.
Many forms have two ILs with nearly 900 bmp's each.
They are configured: 32Bit, Fuchsia, 16x16 (and one 24x24).

In VS2003 there was no issue with this.
Upgrading to VS2005 however makes it impossible to open those forms in
Design-View.
We have tested it with a blank project, and yes, even then it does not work.

-Take a clean project
-Add a form
-Add 2 ImageLists
-Set to 32bit, 16x16 & 24x24, Fuchsia
-Add about 900 bitmaps to each list
-Save
-Close form
-Close VS
-Open VS & SLN
-Open Form in Designmode

Watch the PageFile go up and up up and up up and up.... finally down and
down down and down down and down....

But no form is drawn.

I have tested it on machines with 3Ghz, 2,16GHz (Centrino Duo), Xeon Dual
Proc, all ranging from 1 to 2 GHz Memory. Just to say they are "quite
performant".

Is this a (known) bug or a ImageList limitation?

TIA,
Michael

Apr 27 '06 #1
2 1333
I am not noticing a real issue on my machine. Other than the resource files
are huge and there is a load time (~30 secs) while loading the imagelist's
stream. It seems to be just as fast to populate the images collection from
bitmaps on the harddrive. Perhaps you can alter your solution so that you
are not embedding the graphics in the exe.

Here is my test, given a form, place a checkbox, a numeric updown box, a
picturebox, and three imagelists on the form. To generate the 900 images,
uncomment the code in Form1_Load (Make sure you comment after the first run
so that #1 load times are not affected, #2 the application doesn't crash
trying to save the bitmap to disk.)

Once you have the images, add the 900 images to imagelist1 and imagelist2.
imagelist3 will load them from bmps on the drive.

System Spec's Dell 2.8GHz, 1GB RAM. I should note that I have several
office docs open, three VS IDE's open, virus scan, media player, outlook,
outlook express, and two windows explorer windows.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

For i As Integer = 1 To 900
' Dim bmp As Bitmap

' bmp = New Bitmap(16, 16,
System.Drawing.Imaging.PixelFormat.Format32bppRgb)

' For x As Integer = 0 To 15
' For y As Integer = 0 To 15
' bmp.SetPixel(x, y,
System.Drawing.Color.FromArgb(CInt(Int((Integer.Ma xValue - 1 + 1) * Rnd() +
1))))
' Next
' Next

' Me.ImageList2.Images.Add(i.ToString, bmp)
' bmp.Save(String.Format("C:\Pictures\temp\{0}.bmp", i))
' 'bmp.Dispose()

Dim sFile As String
sFile = String.Format("C:\Pictures\temp\{0}.bmp", i)
Me.ImageList3.Images.Add(i, New Bitmap(sFile))
Next

Me.NumericUpDown1.Minimum = 0
Me.NumericUpDown1.Maximum = Me.ImageList3.Images.Count - 1
Me.NumericUpDown1.DecimalPlaces = 0

End Sub

Private Sub NumericUpDown1_ValueChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles NumericUpDown1.ValueChanged

Dim g As System.Drawing.Graphics

g = Me.PictureBox1.CreateGraphics
g.Clear(Color.Black)

If CheckBox1.Checked Then
Try
g.DrawImage( _
Me.ImageList3.Images(CType(Me.NumericUpDown1.Value , Integer)),
0, 0)
Catch ex As Exception
'
End Try
Else
Try
g.DrawImage( _
Me.ImageList2.Images(CType(Me.NumericUpDown1.Value , Integer)),
0, 0)
Catch ex As Exception
'
End Try
End If

End Sub
"Michael Maes" <mi**********@community.nospam> wrote in message
news:C0**********************************@microsof t.com...
Hi,

We have been using ImageLists in our Projects extensively.
Many forms have two ILs with nearly 900 bmp's each.
They are configured: 32Bit, Fuchsia, 16x16 (and one 24x24).

In VS2003 there was no issue with this.
Upgrading to VS2005 however makes it impossible to open those forms in
Design-View.
We have tested it with a blank project, and yes, even then it does not
work.

-Take a clean project
-Add a form
-Add 2 ImageLists
-Set to 32bit, 16x16 & 24x24, Fuchsia
-Add about 900 bitmaps to each list
-Save
-Close form
-Close VS
-Open VS & SLN
-Open Form in Designmode

Watch the PageFile go up and up up and up up and up.... finally down and
down down and down down and down....

But no form is drawn.

I have tested it on machines with 3Ghz, 2,16GHz (Centrino Duo), Xeon Dual
Proc, all ranging from 1 to 2 GHz Memory. Just to say they are "quite
performant".

Is this a (known) bug or a ImageList limitation?

TIA,
Michael

Apr 27 '06 #2
You are correct about the closing of the project and re-opening though. My
IDE, crashed when I reopened the file, and that was after 10 min with very
little available resources. Wow. I would recommend a seperate resource
file or reading the bmp's directly from disk.
"AMDRIT" <am****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
I am not noticing a real issue on my machine. Other than the resource
files are huge and there is a load time (~30 secs) while loading the
imagelist's stream. It seems to be just as fast to populate the images
collection from bitmaps on the harddrive. Perhaps you can alter your
solution so that you are not embedding the graphics in the exe.

Here is my test, given a form, place a checkbox, a numeric updown box, a
picturebox, and three imagelists on the form. To generate the 900 images,
uncomment the code in Form1_Load (Make sure you comment after the first
run so that #1 load times are not affected, #2 the application doesn't
crash trying to save the bitmap to disk.)

Once you have the images, add the 900 images to imagelist1 and imagelist2.
imagelist3 will load them from bmps on the drive.

System Spec's Dell 2.8GHz, 1GB RAM. I should note that I have several
office docs open, three VS IDE's open, virus scan, media player, outlook,
outlook express, and two windows explorer windows.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

For i As Integer = 1 To 900
' Dim bmp As Bitmap

' bmp = New Bitmap(16, 16,
System.Drawing.Imaging.PixelFormat.Format32bppRgb)

' For x As Integer = 0 To 15
' For y As Integer = 0 To 15
' bmp.SetPixel(x, y,
System.Drawing.Color.FromArgb(CInt(Int((Integer.Ma xValue - 1 + 1) * Rnd()
+ 1))))
' Next
' Next

' Me.ImageList2.Images.Add(i.ToString, bmp)
' bmp.Save(String.Format("C:\Pictures\temp\{0}.bmp", i))
' 'bmp.Dispose()

Dim sFile As String
sFile = String.Format("C:\Pictures\temp\{0}.bmp", i)
Me.ImageList3.Images.Add(i, New Bitmap(sFile))
Next

Me.NumericUpDown1.Minimum = 0
Me.NumericUpDown1.Maximum = Me.ImageList3.Images.Count - 1
Me.NumericUpDown1.DecimalPlaces = 0

End Sub

Private Sub NumericUpDown1_ValueChanged(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles NumericUpDown1.ValueChanged

Dim g As System.Drawing.Graphics

g = Me.PictureBox1.CreateGraphics
g.Clear(Color.Black)

If CheckBox1.Checked Then
Try
g.DrawImage( _
Me.ImageList3.Images(CType(Me.NumericUpDown1.Value ,
Integer)), 0, 0)
Catch ex As Exception
'
End Try
Else
Try
g.DrawImage( _
Me.ImageList2.Images(CType(Me.NumericUpDown1.Value ,
Integer)), 0, 0)
Catch ex As Exception
'
End Try
End If

End Sub
"Michael Maes" <mi**********@community.nospam> wrote in message
news:C0**********************************@microsof t.com...
Hi,

We have been using ImageLists in our Projects extensively.
Many forms have two ILs with nearly 900 bmp's each.
They are configured: 32Bit, Fuchsia, 16x16 (and one 24x24).

In VS2003 there was no issue with this.
Upgrading to VS2005 however makes it impossible to open those forms in
Design-View.
We have tested it with a blank project, and yes, even then it does not
work.

-Take a clean project
-Add a form
-Add 2 ImageLists
-Set to 32bit, 16x16 & 24x24, Fuchsia
-Add about 900 bitmaps to each list
-Save
-Close form
-Close VS
-Open VS & SLN
-Open Form in Designmode

Watch the PageFile go up and up up and up up and up.... finally down and
down down and down down and down....

But no form is drawn.

I have tested it on machines with 3Ghz, 2,16GHz (Centrino Duo), Xeon Dual
Proc, all ranging from 1 to 2 GHz Memory. Just to say they are "quite
performant".

Is this a (known) bug or a ImageList limitation?

TIA,
Michael


Apr 27 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: qushui_chen | last post by:
How can i let ImageList control contain Image in use show the Image really size. I see the ImageList have set ex:Size(255,255);
0
by: Dave Harris | last post by:
We have a piece of code located in an unmanged C++ function that is currently bleeding a GDI each time it is run. We have tried numerous things, each with its own problems. We made pImageList...
0
by: Bruno Zarokian | last post by:
Is it possible to put RGBA bitmaps in an ImageList with the designer ? I'm trying to put some PNG bitmaps with alpha in an ImageList with the designer, but it seems to convert the bitmaps in BMP...
2
by: Sanjeeva Reddy | last post by:
hai Anti Keskinen, i have used the following code MyListView->LargeImageList->ImageSize = gcnew System::Drawing::Size(100, 100); // Sets large image size to 100, 100 here i am getting error...
2
by: copyco | last post by:
I've got an application where I have an animated image in a picturebox. A timer event changes the image by assigning an image from an imagelist to it. I've found that the code for this is causing...
0
by: Chris Putnam | last post by:
I am working on an application that includes a feature where a directory is spidered and thumbnails are displayed. I have it pretty much down, but when the bitmaps are loaded from file, memory is...
6
by: Stephen Costanzo | last post by:
In the code below I receive an exception error because the target file is being used by another process. I know this to be false because the target doesn't exist. It seems like the application...
4
by: David | last post by:
I have a problem that just cropped up with using an ImageList in my project I am using VB .NET 200 Problem: I have existing Form with 2 Image List controls. ImageList16 (for 16x16 Images) and...
4
by: Just Me | last post by:
If I add an image to an imagelist using imageList.Images.Add... And use it with a tree node tn.ImageIndex = imageList.Images.Count-1 This is the actual code:...
2
by: =?Utf-8?B?S2VuTg==?= | last post by:
We're using a System.Windows.Forms.ImageList to store a bunch of Images that I've loaded, and rendering each image in the ImageList during a draw loop. The process was running unusually slow and...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.