コード例 #1
0
        protected override SizeF DpiScale(SizeF baseSize)
        {
            SizeF dpiScaledSize = RadControl.GetDpiScaledSize(baseSize);

            if (this.Orientation == Orientation.Horizontal)
            {
                baseSize.Height = dpiScaledSize.Height;
            }
            else
            {
                baseSize.Width = dpiScaledSize.Width;
            }
            return(baseSize);
        }
コード例 #2
0
 protected virtual SizeF DpiScale(SizeF baseSize)
 {
     return(RadControl.GetDpiScaledSize(baseSize));
 }
コード例 #3
0
        protected override SizeF MeasureOverride(SizeF availableSize)
        {
            SizeF empty      = SizeF.Empty;
            bool  flag1      = this.Orientation == Orientation.Horizontal;
            float sumOfSpace = 0.0f;
            bool  flag2      = false;
            int   count1     = this.items.Count;
            int   count2     = this.overflowPanel.Children.Count;

            if (count1 == 0 && count2 == 0)
            {
                return(RadControl.GetDpiScaledSize(flag1 ? new SizeF(30f, 0.0f) : new SizeF(0.0f, 30f)));
            }
            CommandBarStripElement parent = this.Parent as CommandBarStripElement;
            int currentIndex;

            for (currentIndex = 0; currentIndex < count1; ++currentIndex)
            {
                RadCommandBarBaseItem commandBarBaseItem = this.items[currentIndex];
                if (commandBarBaseItem != null)
                {
                    if (!commandBarBaseItem.VisibleInStrip && parent.Site == null)
                    {
                        commandBarBaseItem.Measure(SizeF.Empty);
                    }
                    else
                    {
                        commandBarBaseItem.Measure(LayoutUtils.InfinitySize);
                        float num1 = flag1 ? commandBarBaseItem.DesiredSize.Width : commandBarBaseItem.DesiredSize.Height;
                        float num2 = flag1 ? availableSize.Width : availableSize.Height;
                        if (parent.Site == null)
                        {
                            if ((double)sumOfSpace + (double)num1 > (double)num2 && this.allowOverflow)
                            {
                                flag2 = true;
                                break;
                            }
                            if (flag1)
                            {
                                commandBarBaseItem.Measure(new SizeF(Math.Max(availableSize.Width - sumOfSpace, 0.0f), availableSize.Height));
                            }
                            else
                            {
                                commandBarBaseItem.Measure(new SizeF(availableSize.Width, Math.Max(availableSize.Height - sumOfSpace, 0.0f)));
                            }
                        }
                        if (flag1)
                        {
                            empty.Width += commandBarBaseItem.DesiredSize.Width;
                            empty.Height = Math.Max(empty.Height, commandBarBaseItem.DesiredSize.Height);
                        }
                        else
                        {
                            empty.Height += commandBarBaseItem.DesiredSize.Height;
                            empty.Width   = Math.Max(empty.Width, commandBarBaseItem.DesiredSize.Width);
                        }
                        sumOfSpace += num1;
                    }
                }
            }
            if (flag2 && parent.Site == null && this.allowOverflow)
            {
                this.HandleOverflowedItems(count1, currentIndex);
            }
            else if (parent.Site == null)
            {
                this.MeasureOverflowedItems(count2, availableSize, sumOfSpace, ref empty);
            }
            if (this.overflowPanel.Children.Count > 0)
            {
                if (this.Orientation == Orientation.Horizontal)
                {
                    empty.Width = availableSize.Width;
                }
                else
                {
                    empty.Height = availableSize.Height;
                }
            }
            return(empty);
        }