Home All Groups Group Topic Archive Search About
Author
11 Jun 2009 9:56 PM
Bee
(1) I found a sample app to work with pictureboxes.
I am stumped by the following.

I set the properties of the width, height, scalewidth and scaleheight
smaller than originally set and see the picturebox change size on the form.

It has no sub main.
Only a Form_Load to start.
I compile it with no errors.

I F8 to single step it.
The first line is
   Me.Show
And immediately the picturebox changes size back to the original size.
I cannot see where this is being done.
Help?

(2) HasDC
Why would I bother to set this to False?
Typically I might use a picturebox to hold other controls on a ssTab, etc.
Easier to .visible that than all the controls on the picturebox.

What I think I remember is that setting HasDC to false for this type of
cotrol use has zero impact other that maybe reducing the footprint.
If so, by how much?
i.e. is it worth it to go back through ALL of my code to set it to False as
appropriate?

I do not like the frame because of the useless caption area that gets in the
way all the time.

Author
11 Jun 2009 10:06 PM
Bee
Oh dang!
The sneeky guy had a loaded bitmap in the .frx and autosize=true.
The bitmap looks like the normal picturebox background.

(2) still open for assistance.

Show quoteHide quote
"Bee" wrote:

> (1) I found a sample app to work with pictureboxes.
> I am stumped by the following.
>
> I set the properties of the width, height, scalewidth and scaleheight
> smaller than originally set and see the picturebox change size on the form.
>
> It has no sub main.
> Only a Form_Load to start.
> I compile it with no errors.
>
> I F8 to single step it.
> The first line is
>    Me.Show
> And immediately the picturebox changes size back to the original size.
> I cannot see where this is being done.
> Help?
>
> (2) HasDC
> Why would I bother to set this to False?
> Typically I might use a picturebox to hold other controls on a ssTab, etc.
> Easier to .visible that than all the controls on the picturebox.
>
> What I think I remember is that setting HasDC to false for this type of
> cotrol use has zero impact other that maybe reducing the footprint.
> If so, by how much?
> i.e. is it worth it to go back through ALL of my code to set it to False as
> appropriate?
>
> I do not like the frame because of the useless caption area that gets in the
> way all the time.
>
Author
12 Jun 2009 8:10 AM
Michael Williams
"Bee" <B**@discussions.microsoft.com> wrote in message
news:86B24E7C-937D-4FC0-90DE-798D956A1DB8@microsoft.com...

> (1) [resolved]
> (2) . . . what I think I remember is that setting HasDC to
> false for this type of cotrol use has zero impact other that
> maybe reducing the footprint. If so, by how much?
> (2) still open for assistance.

Every control (TextBox, PictureBox, etc) requires some memory from a limited
available pool. I think it varies from system to system but as far as I
recall on my own Vista system a non Autoredraw PictureBox eats about 1.2K of
this memory and you can have about 8000 of them before the pool dries up and
your app unceremoneously bites the dust. Setting the PictureBox hasDC
property to False reduces the memory requirement to about 0.7K (as far as I
recall), allowing you to create more of them. These are not large amounts of
memory, but they are being taken from a very limited pool so it is wise not
to waste any more of it than is necessary, although in the case of just a
few PictureBoxes it doesn't really matter.

Mike
Author
11 Jun 2009 10:16 PM
Nobody
"Bee" <B**@discussions.microsoft.com> wrote in message
news:BB80BD4C-6B58-4A6B-A747-C8CEF48693EE@microsoft.com...
> (2) HasDC
> Why would I bother to set this to False?

To reduce memory usage.

> I do not like the frame because of the useless caption area that gets in
> the
> way all the time.

The caption and frame around it can be turned off by setting BorderStyle to
None.