Exemple #1
0
        protected override void OnRender(DrawingContext dc)
        {
            var rounder = new LayoutRounder(this);

            var pen = Caches.GetDashedPen(
                new ByteColor(0xFF, 0x41, 0x69, 0xE1),
                rounder.RoundLayoutValue(2));

            dc.DrawLine(
                pen,
                new Point(0, 0),
                _isVertical
                    ? new Point(ActualWidth, 0)
                    : new Point(0, ActualHeight));
        }
        private void TextBox_PreviewMouseDown(object sender, MouseButtonEventArgs e)
        {
            var textBox = (TextBox)sender;

            var rounder = new LayoutRounder(textBox);

            // 自コントロール上であれば、終了させない
            var pos  = e.GetPosition(textBox);
            var rect = rounder.RoundRenderRectangle(false);

            if (rect.Contains(pos))
            {
                return;
            }

            var parent = textBox.GetParent <BiaEditableTextBlock>();

            Debug.Assert(parent != null);

            FinishEditing(parent, textBox);
        }
Exemple #3
0
        private void MouseOperatorOnMouseMove(object sender, MouseEventArgs e)
        {
            if (_mouseOperator.IsBoxSelect == false)
            {
                return;
            }

            var rounder = new LayoutRounder(this);

            if (Visibility != Visibility.Visible)
            {
                Visibility = Visibility.Visible;
            }

            var r = rounder.RoundLayoutRect(_mouseOperator.SelectionRect);

            var borderWidth = rounder.RoundLayoutValue(2);

            SetLeft(_left, r.X);
            SetTop(_left, r.Y);
            _left.Width  = borderWidth;
            _left.Height = r.Height;

            SetLeft(_right, r.X + r.Width);
            SetTop(_right, r.Y);
            _right.Width  = borderWidth;
            _right.Height = r.Height;

            SetLeft(_top, r.X);
            SetTop(_top, r.Y);
            _top.Width  = r.Width;
            _top.Height = borderWidth;

            SetLeft(_bottom, r.X);
            SetTop(_bottom, r.Y + r.Height);
            _bottom.Width  = r.Width;
            _bottom.Height = borderWidth;
        }