What you are asking is very difficult to do. You would need to use a gui library like GTK or QT to do stuff like this. Both sites have a lot of documentation about making scrollable boxes as you describe. Its hard for seasoned programmers to hand code these. I wouldn't recommend it for a beginner.
If you are just playing around and want this kind of result, use a web page instead. HTML offers ways to have a set box size that will scroll.
This HTML/CSS code will allow something like this:
Top of page
Insert stuff here to see inside the box
Bottom of page
If the content inside the box is not enough, it will simply not scroll.
Sites:
http://www.cplusplus.com/doc/tutorial/files/ - File Input/Output
http://qt.nokia.com/products - QT
http://www.gtk.org/ - gtk
http://www.gtk.org/tutorial1.2/gtk_tut-10.html - gtk boxes
http://doc.trolltech.com/4.4/qscrollarea.html - Qt scroll area docs