In the previous post, Exploring the GrabAPicture Application (Part 1), we discussed the basic parameters for the application—that it provides a means of changing the desktop wallpaper automatically, use online as well as local resources, and sports a command line interface (amongst other features). This post starts building the application.
You’ll start with the basic Windows Forms Application template. Rename the initial form as frmMain (this application will contain a number of forms) by right clicking the form’s entry in Solution Explorer and choosing Rename File from the context menu. This first form is the one that you’ll always see when you start the application from the command line. After you rename the initial form, add two more forms, frmAddEdit (used to add new entries and edit existing entries) and frmConfigure (used to display and manage the list of local and remote sources), by right clicking the project entry in Solution Explorer and choosing Add | New Item from the context menu. You saw the working version of these forms in the previous post.
I’m eliminating a few configuration features from the example for the sake of simplicity. For example, you should include tooltips with your version of the application to make it accessible. When the example is completely finished, you’ll be able to download the source code and see some of these additions for yourself.
Let’s begin with the design of frmMain.
Here’s how frmMain will appear.
This form lets the user type in the location of a piece of wallpaper and use it directly by typing something into Wallpaper Location, selecting a style in Style Selection, and clicking Set Value. The user can also click Random Sources to see a list of available wallpaper sources, which is actually the preferred method of interacting with the application because this technique lets the user save entries for future use. Close will close the form. The user can also use this form to choose whether to use local sources, remote sources, or both. The following table describes the control configuration for this form (add the controls to the form in the order shown to reduce the amount of configuration you must perform).
|Text||Use Random &Local Sources|
|Text||&Use Random Remote Sources|
Next time we’ll look at two other forms. The first helps the user manage local and remote sources. The second will provide the means for adding or editing individual entries. Let me know if you have any questions at John@JohnMuellerBooks.com. You can see the next post in this series at Exploring the GrabAPicture Application (Part 3).