You Are My Crystal

导航

UpDownBase & UpDownBase<T>

public class DoubleUpDown : UpDownBase<double>
    {
        
///<summary>
        
/// Internal constructor.
        
///</summary>
        public DoubleUpDown( )
            : 
base( )
        {
            Value 
= 0;
        }

        
///<summary>
        
/// Called by OnSpin when the spin direction is SpinDirection.Increase.
        
///</summary>
        protected override void OnIncrement( )
        {
            Value 
= Value + 1;
        }

        
///<summary>
        
/// Called by OnSpin when the spin direction is SpinDirection.Increase.
        
///</summary>
        protected override void OnDecrement( )
        {
            Value 
= Value - 1;
        }

        
///<summary>
        
/// Called by ApplyValue to parse user input.
        
///</summary>
        
///<param name="text">User input.</param>
        
///<returns>Value parsed from user input.</returns>
        protected override double ParseValue( string text )
        {
            
return double.Parse( text, CultureInfo.CurrentCulture );
        }

        
///<summary>
        
/// Called to render Value for Text template part to display.
        
///</summary>
        
///<returns>Formatted Value.</returns>
        protected override string FormatValue( )
        {
            
return Value.ToString( CultureInfo.CurrentCulture );
        }
    }

posted on 2011-09-13 13:42  mycrystal  阅读(287)  评论(0编辑  收藏  举报