Exemplo n.º 1
0
        public static void SetCircleAlignment(IBaseItem circle, params ItemAlignment[] alignment)
        {
            List <ItemAlignment> list = new List <ItemAlignment>(alignment.ToArray());

            int offset = circle.GetWidth() / 3;

            if (list.Contains(ItemAlignment.Top))
            {
                circle.SetMargin(circle.GetMargin().Left, circle.GetMargin().Top - offset + 10, circle.GetMargin().Right,
                                 circle.GetMargin().Bottom);
            }

            if (list.Contains(ItemAlignment.Bottom))
            {
                circle.SetMargin(circle.GetMargin().Left, circle.GetMargin().Top, circle.GetMargin().Right,
                                 circle.GetMargin().Bottom - offset);
            }

            if (list.Contains(ItemAlignment.Left))
            {
                circle.SetMargin(circle.GetMargin().Left - offset, circle.GetMargin().Top, circle.GetMargin().Right,
                                 circle.GetMargin().Bottom);
            }

            if (list.Contains(ItemAlignment.Right))
            {
                circle.SetMargin(circle.GetMargin().Left, circle.GetMargin().Top, circle.GetMargin().Right - offset,
                                 circle.GetMargin().Bottom);
            }
        }
Exemplo n.º 2
0
        public void Show(IItem sender, MouseArgs args)
        {
            InitElements();
            IBaseItem item = sender as IBaseItem;

            SetPosition(item.GetX() + item.GetWidth(), item.GetY());
            SetHeight(item.GetHeight());
            SetWidth(_label.GetTextWidth() + _label.GetMargin().Left + _label.GetMargin().Right);
            Show();
        }