paint handler problem

J

Joep

L.S.,

I am using the picture box's paint event to load an image if not yet loaded.
The picture box is one of many that together occupy the area of a panel. Not
all boxes are visible so not all images have to be preloaded.

Problem is that some images do show while others do not.

My paint handler just loads the image of not yet loaded.

Do I have to call the original paint handler to do the painting? I am not
painting anything from my paint handler but some images do get painted.

A little confused...any one has a clue?

This is in the handler:

PictureBox p = (PictureBox) sender;
if( p.Tag is string )
{
if( p.Image == null )
{
p.SuspendLayout();
p.Image = Image.FromFile( m_imageFile );
p.ResumeLayout();
}
}


T.I.A.
 
J

Joep

Thanks,

Problem is caused by panel that is limited to a maximum size (i.e. Size
members are ints). The collection of picture boxes exceeds that maximum. So
I will need more than one panel if dimensions exceed maximum of a single
panel.

Calling base is not needed, picture boxes within range ARE painted so the
picture box's paint handler is called as well as my added handler.


Bye
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top