protected virtual RectangleF GetRectangle(LineInfo currentLine)
        {
            TextBoxViewElement viewElement       = this.textBoxElement.ViewElement;
            RectangleF         boundingRectangle = currentLine.ControlBoundingRectangle;
            PointF             absolute1         = viewElement.PointToAbsolute(boundingRectangle.Location);
            ITextBlock         textBlock         = currentLine.StartBlock;
            ITextBlock         endBlock          = currentLine.EndBlock;

            while (TextBoxWrapPanel.IsWhitespace(textBlock.Text))
            {
                ITextBlock nextBlock = this.TextBoxElement.ViewElement.GetNextBlock(textBlock.Index);
                if (nextBlock != null)
                {
                    textBlock   = nextBlock;
                    absolute1.Y = viewElement.PointToAbsolute((PointF)textBlock.ControlBoundingRectangle.Location).Y;
                }
                else
                {
                    break;
                }
            }
            PointF location  = (PointF)textBlock.ControlBoundingRectangle.Location;
            PointF absolute2 = viewElement.PointToAbsolute(location);
            PointF pointF    = new PointF((float)endBlock.ControlBoundingRectangle.Right, (float)endBlock.ControlBoundingRectangle.Y);

            pointF                     = viewElement.PointToAbsolute(pointF);
            absolute1.X                = absolute2.X;
            boundingRectangle.Width    = pointF.X - boundingRectangle.X;
            boundingRectangle.Location = absolute1;
            return(boundingRectangle);
        }
Exemple #2
0
 public static bool IsTabOrWhitespace(string text)
 {
     if (!TextBoxWrapPanel.IsTab(text))
     {
         return(TextBoxWrapPanel.IsWhitespace(text));
     }
     return(true);
 }
Exemple #3
0
 public static bool IsSpecialText(string text)
 {
     if (!TextBoxWrapPanel.IsWhitespace(text) && !TextBoxWrapPanel.IsTab(text) && (!TextBoxWrapPanel.IsLineFeed(text) && !TextBoxWrapPanel.IsCarriageReturn(text)) && !(text == Environment.NewLine))
     {
         return(TextBoxWrapPanel.ContainsNewLine(text));
     }
     return(true);
 }
Exemple #4
0
        protected virtual SizeF ArrangeWithLeftAlignment(SizeF finalSize)
        {
            RectangleF clientRectangle = this.GetClientRectangle(finalSize);
            float      x = clientRectangle.X;
            float      y = clientRectangle.Y;

            foreach (LineInfo line in (ReadOnlyCollection <LineInfo>) this.lines)
            {
                ITextBlock startBlock = line.StartBlock;
                ITextBlock endBlock   = line.EndBlock;
                int        index      = startBlock.Index;
                if (TextBoxWrapPanel.IsWhitespace(startBlock.Text) && !TextBoxWrapPanel.IsTab(startBlock.Text) && this.lines.IndexOf(line) > 0)
                {
                    ++index;
                }
                for (; index <= endBlock.Index; ++index)
                {
                    RadElement child     = this.Children[index];
                    ITextBlock textBlock = child as ITextBlock;
                    child.InvalidateArrange();
                    PointF location       = new PointF(x, y);
                    SizeF  desiredSize    = textBlock.DesiredSize;
                    float  baselineOffset = this.GetBaselineOffset(line, textBlock);
                    location.Y += (float)Math.Ceiling((double)baselineOffset);
                    textBlock.Arrange(new RectangleF(location, desiredSize));
                    if (textBlock == endBlock)
                    {
                        float width = (float)(endBlock.ControlBoundingRectangle.Right - startBlock.ControlBoundingRectangle.X);
                        line.Size = new SizeF(width, line.Size.Height);
                    }
                    x += desiredSize.Width;
                }
                x  = clientRectangle.X;
                y += line.Size.Height + (float)this.lineSpacing;
            }
            return(finalSize);
        }