Ejemplo n.º 1
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);
 }
Ejemplo n.º 2
0
 public static bool IsTabOrWhitespace(string text)
 {
     if (!TextBoxWrapPanel.IsTab(text))
     {
         return(TextBoxWrapPanel.IsWhitespace(text));
     }
     return(true);
 }
Ejemplo n.º 3
0
 public static Size MeasureText(string text, Font font)
 {
     using (Graphics graphics = Graphics.FromHwnd(IntPtr.Zero))
     {
         graphics.TextRenderingHint = TextRenderingHint.SystemDefault;
         Size size = TextRenderer.MeasureText((IDeviceContext)graphics, text, font, Size.Empty, TextFormatFlags.NoClipping | TextFormatFlags.NoPrefix | TextFormatFlags.SingleLine | TextFormatFlags.PreserveGraphicsClipping | TextFormatFlags.PreserveGraphicsTranslateTransform | TextFormatFlags.NoPadding);
         if (TextBoxWrapPanel.IsTab(text))
         {
             size.Width = RadGdiGraphics.GetTextMetric(font).aveCharWidth * 4;
         }
         return(size);
     }
 }
Ejemplo n.º 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);
        }