Example #1
0
        /// <summary>
        /// Initializes the designer with the specified component.
        /// </summary>
        /// <param name="component">The IComponent to associate the designer with.</param>
        public override void Initialize(IComponent component)
        {
            // ReSharper disable RedundantBaseQualifier
            // Let base class do standard stuff
            base.Initialize(component);
            base.AutoResizeHandles = true;
            // ReSharper restore RedundantBaseQualifier

            // Cast to correct type
            _trackBar = component as KryptonTrackBar;
        }
Example #2
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 property
                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
                    _action = (Orientation)orientationProp.GetValue(_trackBar) == Orientation.Vertical
                        ? "Horizontal orientation"
                        : "Vertical orientation";
                }
            }

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