상속: System.Windows.Forms.Design.ControlDesigner
예제 #1
0
        /// <summary>
        /// Initialize a new instance of the KryptonTrackBarActionList class.
        /// </summary>
        /// <param name="owner">Designer that owns this action list instance.</param>
        public KryptonTrackBarActionList(KryptonTrackBarDesigner owner)
            : base(owner.Component)
        {
            _trackBar = owner.Component as KryptonTrackBar;

            // Assuming we were correctly passed an actual component...
            if (_trackBar != null)
            {
                // Get access to the actual Orientation propertry
                PropertyDescriptor orientationProp = TypeDescriptor.GetProperties(_trackBar)["Orientation"];

                // If we succeeded in getting the property
                if (orientationProp != null)
                {
                    // Decide on the next action to take given the current setting
                    if ((Orientation)orientationProp.GetValue(_trackBar) == Orientation.Vertical)
                    {
                        _action = "Horizontal orientation";
                    }
                    else
                    {
                        _action = "Vertical orientation";
                    }
                }
            }

            // Cache service used to notify when a property has changed
            _service = (IComponentChangeService)GetService(typeof(IComponentChangeService));
        }
        /// <summary>
        /// Initialize a new instance of the KryptonTrackBarActionList class.
        /// </summary>
        /// <param name="owner">Designer that owns this action list instance.</param>
        public KryptonTrackBarActionList(KryptonTrackBarDesigner owner)
            : base(owner.Component)
        {
            _trackBar = owner.Component as KryptonTrackBar;

            // Assuming we were correctly passed an actual component...
            if (_trackBar != null)
            {
                // Get access to the actual Orientation propertry
                PropertyDescriptor orientationProp = TypeDescriptor.GetProperties(_trackBar)["Orientation"];

                // If we succeeded in getting the property
                if (orientationProp != null)
                {
                    // Decide on the next action to take given the current setting
                    if ((Orientation)orientationProp.GetValue(_trackBar) == Orientation.Vertical)
                        _action = "Horizontal orientation";
                    else
                        _action = "Vertical orientation";
                }
            }

            // Cache service used to notify when a property has changed
            _service = (IComponentChangeService)GetService(typeof(IComponentChangeService));
        }