Game Development Reference
Figure 26.4 Screenshot of the demo application using the texture browser.
This chapter covered the construction of a reusable control that can display images
in a visually appealing way, and can also manage the handling and notification of
events associated with the control.
There are some places where refactoring could improve the overall design of the
component, but the most notable place is the Managed Direct3D loader. The point
of having pluggable interfaces is to decouple the reliance on external dependencies
when a particular component is not in use. Consider the situation where it is preferred
that an application consuming this control does not use the Managed Direct3D
loader, but instead uses the native GDI+ version. Sure, the loader can be set to
native, but the component is still referencing the managed DirectX assemblies. If
the consuming application is launched on a system without these assemblies, then
a File Not Found exception would be thrown during execution, even though the
Managed Direct3D loader is never used.