Пример #1
0
        public void UpdateLabelElements()
        {
            if (this.TrackBarElement.Orientation == Orientation.Horizontal)
            {
                this.StretchHorizontally = true;
                this.StretchVertically   = false;
            }
            else
            {
                this.StretchHorizontally = false;
                this.StretchVertically   = true;
            }
            this.Children.Clear();
            this.Invalidate();
            int  num1      = 0;
            bool isTopLeft = (this.Parent as TrackBarScaleElement).IsTopLeft;

            for (int index = 0; index <= this.TrackBarElement.MaxTickNumber; ++index)
            {
                if (this.largeTickFrequency > 0 && index % this.largeTickFrequency == 0)
                {
                    TrackBarLabelElement labelElement = new TrackBarLabelElement();
                    labelElement.NotifyParentOnMouseInput = true;
                    labelElement.ShouldHandleMouseInput   = false;
                    float num2 = this.TrackBarElement.Minimum + (float)(num1 * this.largeTickFrequency);
                    labelElement.Text      = num2.ToString();
                    labelElement.IsTopLeft = isTopLeft;
                    this.OnLabelFormatting(labelElement);
                    this.Children.Add((RadElement)labelElement);
                    ++num1;
                }
            }
            int orientation = (int)this.TrackBarElement.Orientation;
        }
Пример #2
0
        protected internal virtual void OnLabelFormatting(TrackBarLabelElement labelElement)
        {
            LabelFormattingEventHandler labelFormatting = this.LabelFormatting;

            if (labelFormatting == null)
            {
                return;
            }
            labelFormatting((object)this, new LabelFormattingEventArgs(labelElement));
        }
Пример #3
0
        protected override SizeF MeasureOverride(SizeF availableSize)
        {
            SizeF empty = SizeF.Empty;

            if (this.TrackBarElement.Orientation == Orientation.Horizontal)
            {
                for (int index = 0; index < this.Children.Count; ++index)
                {
                    TrackBarLabelElement child = this.Children[index] as TrackBarLabelElement;
                    if (child != null)
                    {
                        child.Measure(availableSize);
                        empty.Height = Math.Max(empty.Height, child.DesiredSize.Height);
                        empty.Width += child.DesiredSize.Width;
                        if ((index == 0 || index == this.Children.Count - 1) && (double)child.DesiredSize.Width / 2.0 > (double)this.TrackBarElement.ThumbSize.Width && (double)this.TrackBarElement.BodyElement.Margin.Left < (double)child.DesiredSize.Width / 2.0 - (double)this.TrackBarElement.ThumbSize.Width)
                        {
                            int num = (int)child.DesiredSize.Width / 2 - this.TrackBarElement.ThumbSize.Width + 2;
                            this.TrackBarElement.BodyElement.Margin = new Padding(num, this.TrackBarElement.BodyElement.Margin.Top, num, this.TrackBarElement.BodyElement.Margin.Bottom);
                        }
                    }
                }
                if ((double)empty.Height == 0.0)
                {
                    empty.Width = 0.0f;
                }
            }
            else
            {
                for (int index = 0; index < this.Children.Count; ++index)
                {
                    TrackBarLabelElement child = this.Children[index] as TrackBarLabelElement;
                    if (child != null)
                    {
                        child.Measure(availableSize);
                        empty.Height += child.DesiredSize.Height;
                        empty.Width   = Math.Max(empty.Width, child.DesiredSize.Width);
                        if ((index == 0 || index == this.Children.Count - 1) && (double)child.DesiredSize.Height / 2.0 > (double)this.TrackBarElement.ThumbSize.Height && (double)this.TrackBarElement.BodyElement.Margin.Top < (double)child.DesiredSize.Height / 2.0 - (double)this.TrackBarElement.ThumbSize.Height)
                        {
                            int num = (int)child.DesiredSize.Height / 2 - this.TrackBarElement.ThumbSize.Height + 1;
                            this.TrackBarElement.BodyElement.Margin = new Padding(this.TrackBarElement.BodyElement.Margin.Left, num, this.TrackBarElement.BodyElement.Margin.Right, num);
                        }
                    }
                }
                if ((double)empty.Width == 0.0)
                {
                    empty.Height = 0.0f;
                }
            }
            return(empty);
        }
Пример #4
0
 protected virtual void OnLabelFormatting(TrackBarLabelElement labelElement)
 {
     this.TrackBarElement.OnLabelFormatting(labelElement);
 }
 public LabelFormattingEventArgs(TrackBarLabelElement labelElement)
 {
     this.labelElement = labelElement;
 }