在《Foundations of GTK+ Development》书中看到对于scrolled window添加内容的办法
After you have set up a scrolled window, you should add a child widget for it to be of any use. There are two possible ways to do this, and the method is chosen based on the type of child widget. If you are using a GtkTextView, GtkTreeView, GtkIconView, GtkViewport, or GtkLayout widget, you should use the default gtk_container_add() function, since all five of these widgets include native scrolling support.
All other GTK+ widgets do not have native scrolling support. For those widgets, gtk_scrolled_window_add_with_viewport() should be used. This function will give the child scrolling support by first packing it into a container widget called a GtkViewport. This widget implements scrolling ability for the child widget that lacks its own support. The viewport is then automatically added to the scrolled window.
使用下面的办法直接在scrolledwindow里面添加一个垂直容器
发现scrolledwindow有内边框很难看,而且无法消除。因为这是gtk_scrolled_window_add_with_viewport自动添加的viewport的边框。看到
It is possible to manually add a widget to a new GtkViewport and then add that viewport to a scrolled window with gtk_container_add().
于是自己创建viewport,取消边框后用gtk_container_add直接加入scrolledwindow就消除了边框