panel or picturebox

I think Panel in VB.NET is basically what PictureBox was in VB6... I mean
who really used them to display pictures? They were used as drawing
surfaces, control containers, and buttons, but rarely was the PictureBox
used over the Image control to display pictures.

In VB.NET, the Panel, I believe, is what you use for a control container
and whatnot, while the PictureBox is for displaying images (note the
lack of an Image control). I'm not 100% sure which you should use
for drawing on (when you're not using the form) in the case of a
painting program or whatever, but I would assume the PictureBox.
It probably doesn't matter much though.
 
Panels are pretty nifty...

Panels can be used to position controls in different grids, that's 1 thing...

but what comes in Reallll handy is when you want to use a spliter control...

Try this:
* start with a new blank form
* draw a panel with half the height of the form
* set this panel1.dock to "top"
* draw a spliter control on the form right under the panel1
* set the spliter.dock to "top"
* set the spliter to a height of about 6 pixels
* draw another panel, panel2, under the spliter
* set panel2.dock to "fill"
* change the .backcolor of both panels to 2 different colors like yellow and blue

Run the form
drag the spliter up and down ;-)

Nifty, int'nit?
 
addition...

Forgot to mention....

try changing the .visible property of either panel to "false"

it will disappear but when it goes back to visible, it's back like normal...

Why is this important you ask??

try putting controls on the panel, such as a textbox and then set the textbox.dock to "fill", now the textbox is scalable.

there's much more to it too
 
Also, a Panel supports automatic scrollbars. Draw a textbox really wide, say 200 pixels. Now draw a Panel, say 100 pixels wide. Drop the textbox into the Panel and turn on the AutoScroll properties. You'll see the Panel control can automatically add scrollbars and make them the right size to fit all your controls.

I would not recommend doing this except in rare cases. It's not a very standard look, but can be handy if used properly.

-Ner
 
Back
Top