Game Development Reference
This chapter described what the Windows Clipboard is used for and how to store
and retrieve arbitrary data on it. The Clipboard is a standard Windows feature that
users expect to work in all applications, so it is advisable that you implement
Clipboard functionality where appropriate in order to promote comfortable user
Additionally, Clipboard functionality in terms of availability in the user interface
is only meaningful in certain contexts. The Cut and Copy commands should only
be enabled when data is selected. The Paste command should only be enabled
when appropriate data is on the Clipboard. Be sure to design user interfaces that
are easy for users to intuit and understand.
The Companion Web site includes the complete source code shown in this chap-
ter, including a simple WinForms application that uses the Clipboard helper class.
This demo application is shown in Figure 31.1.
Figure 31.1 Screenshot of the demo application on the Companion Web site.
The Clipboard is fairly simple to understand, though it is important to properly
implement its functionality because users are so accustomed to its existence.