Getting ready

To demonstrate the combination of the Canvas and Scrollbar classes to create a resizable and scrollable frame, we will build an application that dynamically changes its size by loading an image.

When the Load image button is clicked, it removes itself and loads an image into the Canvas that is larger than the scrollable region—for this example, we used a predefined image, but you can modify this program to select any other GIF image with a file dialog:

This enables the horizontal and vertical scrollbars, which automatically adjust themselves if the main window is resized:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset