private void txtComponentValue_LostFocus( object sender, EventArgs e )
{
ColorSpaceComponentTextBox textbox = ( ColorSpaceComponentTextBox ) sender;
int componentValue;
int resetValue;
bool showError = true;
if ( textbox.Text != null && textbox.Text.Length != 0 ) {
componentValue = Int32.Parse( textbox.Text );
resetValue = componentValue;
if ( ( componentValue > this.MaximumValue ) ) {
resetValue = this.MaximumValue;
} else if ( componentValue < this.MinimumValue ) {
resetValue = this.MinimumValue;
} else {
showError = false;
}
} else {
resetValue = this.MinimumValue;
}
if ( showError ) {
//MessageBox.Show( this, String.Format( "An integer between {0} and {1} is required. Closest value inserted.", this.MinimumValue, this.MaximumValue), "Color Picker", MessageBoxButtons.OK, MessageBoxIcon.Error );
}
textbox.Text = resetValue.ToString();
}