Game Development Reference
In-Depth Information
takes the image data of the associated texture handle, resizes it to the appropriate
size, and then uses a resized copy of the original image for the display.
The thumbnail control also handles the visual appearance for selection. The con-
structor accepts a reference to the texture browser instance so that visual proper-
ties can be used and applied to the thumbnail control.
Aside from visual properties, the reference to the texture browser is used by the
thumbnail control to relay event information back to the browser control.
The following code defines the thumbnail control and its related properties and
functionality.
public partial class TextureThumbnail : UserControl
{
private TextureBrowser _container;
private TextureHandle _texture;
private bool _selected;
public TextureHandle Texture
{
get { return _texture; }
}
public bool Selected
{
get { return _selected; }
set
{
if (_container == null)
return;
if (value)
{
this.BackColor = Color.Blue;
FileNameLabel.BackColor = _container.BackgroundColorSelected;
FileNameLabel.ForeColor = _container.ForegroundColorSelected;
DimensionsLabel.BackColor = _container.BackgroundColorSelected;
DimensionsLabel.ForeColor = _container.ForegroundColorSelected;
}
else
{
Search Nedrilad ::




Custom Search