Пример #1
0
 /// <summary>
 /// Creates an icon for a button that displays a list of all tabs.
 /// </summary>
 protected Point[] CreateAllTabsButtonIcon(TabViewLayout layout, Rectangle rect, int size)
 {
     if (layout == TabViewLayout.Vertical)
     {
         return(VectorIcons.DownArrow(rect, size));
     }
     else
     {
         return(VectorIcons.RightArrow(rect, size));
     }
 }
        protected override void UpdateLayout()
        {
            base.UpdateLayout();

            int       iconSize = ArrowSize;
            Rectangle baseRect = ClientRectangle;

            baseRect.Size -= this.Padding.Size;
            baseRect.X    += this.Padding.Left;
            baseRect.Y    += this.Padding.Top;

            Rectangle arrowRect = ClientRectangle;

            arrowRect.Width  = iconSize < baseRect.Width ? iconSize : baseRect.Width;
            arrowRect.Height = iconSize < baseRect.Height ? iconSize : baseRect.Height;
            arrowRect.X      = baseRect.X + (baseRect.Width - arrowRect.Width) / 2;
            arrowRect.Y      = baseRect.Y + (baseRect.Height - arrowRect.Height) / 2;

            Arrow = VectorIcons.Arrow(arrowRect, ArrowDirection);

            this.Invalidate();
        }
Пример #3
0
 protected override void UpdateLayout()
 {
     base.UpdateLayout();
     Arrow = VectorIcons.DownArrow(DropIconRect, DropIconSize);
 }
Пример #4
0
        protected virtual void UpdateLayout()
        {
            Rectangle viewRect    = this.ClientRectangle;
            Padding   viewPadding = this.Padding;

            Rectangle labelRect;
            Rectangle checkBackRect;
            Rectangle checkRect;

            int checkWidth  = this.CheckmarkWidth;
            int checkHeight = this.CheckmarkHeight;
            int checkOffset = 5;

            checkBackRect = new Rectangle();

            switch (CheckmarkAlignment)
            {
            case VerticalAlignment.Top:
                checkBackRect.X = viewRect.Left + viewPadding.Left;
                checkBackRect.Y = viewRect.Top + viewPadding.Top;
                break;

            case VerticalAlignment.Middle:
                checkBackRect.X = viewRect.Left + viewPadding.Left;
                checkBackRect.Y = viewPadding.Top + (viewRect.Height - viewPadding.Vertical - checkHeight) / 2;
                break;

            case VerticalAlignment.Bottom:
                checkBackRect.X = viewRect.Left + viewPadding.Left;
                checkBackRect.Y = viewRect.Bottom - viewPadding.Bottom - checkHeight;
                break;
            }

            switch (Style)
            {
            case CheckmarkStyle.Checkmark:
                checkBackRect.Width = checkBackRect.Height = checkHeight;
                checkRect           = checkBackRect;
                checkRect.Width     = checkRect.Height -= checkOffset * 2;
                checkRect.X        += checkOffset;
                checkRect.Y        += checkOffset;
                this.CheckmarkIcon  = VectorIcons.Checkmark(checkRect);
                break;

            case CheckmarkStyle.Square:
                checkBackRect.Width = checkBackRect.Height = checkHeight;
                checkRect           = checkBackRect;
                checkRect.Width     = checkRect.Height -= checkOffset * 2;
                checkRect.X        += checkOffset;
                checkRect.Y        += checkOffset;
                break;

            case CheckmarkStyle.Toggle:
                checkBackRect.Width  = checkWidth;
                checkBackRect.Height = checkHeight;
                checkRect            = checkBackRect;
                checkRect.Width     -= checkOffset * 2;
                checkRect.Width     /= 2;
                checkRect.Height    -= checkOffset * 2;
                checkRect.X         += checkOffset;
                checkRect.Y         += checkOffset;

                if (Checked == true)
                {
                    checkRect.X += checkRect.Width;
                }
                break;

            default:
                checkBackRect.Width  = checkWidth;
                checkBackRect.Height = checkHeight;
                checkRect            = checkBackRect;
                break;
            }

            labelRect = new Rectangle(
                viewRect.Left + viewPadding.Left + checkBackRect.Width + TextOffset,
                viewRect.Top + viewPadding.Top,
                viewRect.Width - viewPadding.Horizontal - checkBackRect.Width - TextOffset,
                viewRect.Height - viewPadding.Vertical);

            TextRect          = labelRect;
            CheckmarkBackRect = checkBackRect;
            CheckmarkRect     = checkRect;

            textFormat = DrawingUtils.ContentAlignmentToTextFormatFlags(TextAlignment);

            textFormat |= TextFormatFlags.TextBoxControl
                          | TextFormatFlags.WordBreak
                          | TextFormatFlags.EndEllipsis;

            if (Multiline)
            {
                textFormat |= TextFormatFlags.WordBreak;
                textFormat &= ~TextFormatFlags.SingleLine;
            }
            else
            {
                textFormat |= TextFormatFlags.SingleLine;
                textFormat &= ~TextFormatFlags.WordBreak;
            }

            this.Invalidate();
        }