protected override void OnLayout(LayoutEventArgs levent)
{
base.OnLayout (levent);
if ( File.Exists( m_customSwatchesFile ) ) {
m_swatches = ColorSwatchXml.ReadSwatches( m_customSwatchesFile, false );
} else {
CreateCustomSwatchesFile();
m_swatches = ColorSwatchXml.ReadSwatches( "ColorSwatches.xml", true );
}
m_swatchOuterRegionWidth = this.Width - ( ( this.Width - ( 2 * OUTER_PADDING ) ) ) % ( SWATCH_WIDTH + PADDING );
m_swatchOuterRegionHeight = this.Height - ( ( this.Height - ( 2 * OUTER_PADDING ) ) ) % ( SWATCH_HEIGHT + PADDING );
int horizSwatches = ( m_swatchOuterRegionWidth - ( 2 * OUTER_PADDING ) ) / ( SWATCH_WIDTH + PADDING );
int vertSwatches = ( m_swatchOuterRegionHeight - ( 2 * OUTER_PADDING ) ) / ( SWATCH_HEIGHT + PADDING );
m_swatchArray = new ColorSwatch[ horizSwatches, vertSwatches ];
}