472,334 Members | 2,042 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,334 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 1273
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,...
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...
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...
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...
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...
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...
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...
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...
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...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

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.