To see how Windows Forms can be used to create a more
realistic Windows application, you’ll build a utility named
FileCopier that copies all files from a group of directories
selected by the user to a single target directory or device, such as a
floppy or backup hard drive on the company network. Although you won’t
implement every possible feature, this example will provide a good
introduction to what it is like to build meaningful Windows
For the purposes of this example and to keep the code simple, you’ll focus on the user interface and the steps needed to wire up its various controls. The final application UI is shown in Figure 18-8.
The user interface for
FileCopier consists of the following
Labels (Source Files, Target Files, and Status)
Buttons (Clear, Copy, Delete, and Cancel)
An “Overwrite if exists” checkbox
A text box displaying the path of the selected target directory
TreeView controls (source and target directories)
Figure 18-8. The FileCopier user interface
The goal is to allow the user to check files (or entire directories) in the left tree view (source). If the user clicks the Copy button, the files checked on the left side will be copied to the Target Directories specified on the right-side control. If the user clicks Delete, the checked files will be deleted.
The example you’re about to create is much more ...