System.Windows.Forms.Control maximum sizes

  • Thread starter Thread starter Steve McLellan
  • Start date Start date
S

Steve McLellan

Hi,

Does anyone know how Windows allocates memory for controls? For example,
given a huge Panel, say, in a relatively much smaller Form with scrollbars,
will Windows attempt to allocate a huge area of memory for the Panel's
visible surface, or will it only allocate as much as is required (i.e. as
much as is visible)?

If the former, is there any way of preventing this? Like telling it that at
this point in time, only X amount of the panel will be necessary?

Thanks,

Steve
 
Steve,

windows doesn't allocate memory for contorl surfaces. Amount of memory used
depends on the number of controls used on form, not of its size.

HTH
Alex
 
Hi,

Thanks for the reply. To clarify then, I should be able to create a Panel
that's 100,000 X 100,000 pixels if I like, and as long as I don't try to put
an Image on top of it it should be fine? In that case, how does Windows
decide what to display for any parts of the control that are visible? And
assuming it buffers the visible surface, is it definitely the case that it
doesn't try to buffer the entire surface of the control?

Steve
 
Steve,
In addition to the other comments.

The visible surface of a control is painted (created) each time in the
controls Paint event. There is no memory allocated for the display of the
control per se.

For a complete discussion on Controls & Windows Forms and Paint events, see
Charles Petzold's book "Programming Microsoft Windows with Microsoft Visual
Basic .NET - Core Reference" from MS Press, a C# version of the book is also
available.

Hope this helps
Jay
 
Back
Top