469,613 Members | 1,365 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,613 developers. It's quick & easy.

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 1197
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by qushui_chen | last post: by
reply views Thread by Dave Harris | last post: by
reply views Thread by Bruno Zarokian | last post: by
2 posts views Thread by copyco | last post: by
6 posts views Thread by Stephen Costanzo | last post: by
4 posts views Thread by Just Me | last post: by
2 posts views Thread by =?Utf-8?B?S2VuTg==?= | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.