Inheritance: VisualSimpleBase
Beispiel #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>
        /// Initialise a new instance of the KryptonRibbonGroupTrackBar class.
        /// </summary>
        public KryptonRibbonGroupTrackBar()
        {
            // Default fields
            _visible = true;
            _enabled = true;
            _itemSizeCurrent = GroupItemSize.Medium;
            _keyTip = "T";
            _minimumLength = 55;
            _maximumLength = 55;

            // Create the actual track barcontrol and set initial settings
            _trackBar = new KryptonTrackBar();
            _trackBar.DrawBackground = false;
            _trackBar.TickStyle = TickStyle.None;
            _trackBar.MinimumSize = new Size(_minimumLength, 0);
            _trackBar.MaximumSize = new Size(_maximumLength, 0);
            _trackBar.TabStop = false;

            // Hook into events to expose via this container
            _trackBar.GotFocus += new EventHandler(OnTrackBarGotFocus);
            _trackBar.LostFocus += new EventHandler(OnTrackBarLostFocus);
            _trackBar.ValueChanged += new EventHandler(OnTrackBarValueChanged);

            // Ensure we can track mouse events on the track bar
            MonitorControl(_trackBar);
        }
        /// <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));
        }
Beispiel #4
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)
        {
            // Let base class do standard stuff
            base.Initialize(component);
            base.AutoResizeHandles = true;

            // Cast to correct type
            _trackBar = component as KryptonTrackBar;
        }
Beispiel #5
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;
        }
Beispiel #6
0
 public KryptonTrackBarProxy(KryptonTrackBar trackBar)
 {
     _trackBar = trackBar;
 }
        /// <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)
        {
            // Let base class do standard stuff
            base.Initialize(component);
            base.AutoResizeHandles = true;

            // Cast to correct type
            _trackBar = component as KryptonTrackBar;
        }
        private void UpdateParent(Control parentControl)
        {
            // Is there a change in the textbox or a change in
            // the parent control that is hosting the control...
            if ((parentControl != LastParentControl) ||
                (LastTrackBar != _ribbonTrackBar.TrackBar))
            {
                // We only modify the parent and visible state if processing for correct container
                if ((_ribbonTrackBar.RibbonContainer.RibbonGroup.ShowingAsPopup && (parentControl is VisualPopupGroup)) ||
                    (!_ribbonTrackBar.RibbonContainer.RibbonGroup.ShowingAsPopup && !(parentControl is VisualPopupGroup)))
                {
                    // If we have added the custrom control to a parent before
                    if ((LastTrackBar != null) && (LastParentControl != null))
                    {
                        // If that control is still a child of the old parent
                        if (LastParentControl.Controls.Contains(LastTrackBar))
                        {
                            // Check for a collection that is based on the read only class
                            LastParentControl.Controls.Remove(LastTrackBar);
                        }
                    }

                    // Remember the current control and new parent
                    LastTrackBar = _ribbonTrackBar.TrackBar;
                    LastParentControl = parentControl;

                    // If we have a new textbox and parent
                    if ((LastTrackBar != null) && (LastParentControl != null))
                    {
                        // Ensure the control is not in the display area when first added
                        LastTrackBar.Location = new Point(-LastTrackBar.Width, -LastTrackBar.Height);

                        // Check for the correct visible state of the textbox
                        UpdateVisible(LastTrackBar);

                        // Check for a collection that is based on the read only class
                        LastParentControl.Controls.Add(LastTrackBar);
                    }
                }
            }
        }
 private void UnmonitorControl(KryptonTrackBar c)
 {
     c.MouseEnter -= new EventHandler(OnControlEnter);
     c.MouseLeave -= new EventHandler(OnControlLeave);
 }
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (_trackBar != null)
                {
                    UnmonitorControl(_trackBar);
                    _trackBar.Dispose();
                    _trackBar = null;
                }
            }

            base.Dispose(disposing);
        }