Example #1
0
        int IHeightAdaptable.CalcHeight(GraphicsCache cache, int width)
        {
            BorderObjectInfoArgs info = new BorderObjectInfoArgs(cache);

            info.Bounds = new Rectangle(0, 0, width, 100);
            Rectangle textRect = BorderPainter.GetObjectClientRectangle(info);

            if (!(BorderPainter is EmptyBorderPainter))
            {
                textRect.Inflate(-1, -1);
            }
            string text = string.Empty;

            text = DisplayText;
            if (text != null && text.Length > 0)
            {
                char lastChar = text[text.Length - 1];
                if (lastChar == 13 || lastChar == 10)
                {
                    text += "W";
                }
            }
            int height = CalcTextSizeCore(cache, text, textRect.Width).Height + 1;

            return((height + 100 - textRect.Bottom) + 1);
        }
Example #2
0
        protected override void DrawSelected(ObjectInfoArgs e)
        {
            BorderObjectInfoArgs ee = e as BorderObjectInfoArgs;
            Brush pen = e.Cache.GetSolidBrush(ee.BackAppearance.BorderColor);

            e.Cache.Paint.DrawRectangle(e.Graphics, pen, e.Bounds);
        }
Example #3
0
        int IHeightAdaptable.CalcHeight(GraphicsCache cache, int width)
        {
            width -= ((MyRepositoryItemMemoEdit)Item).ContentImageSize.Width;
            BorderObjectInfoArgs info = new BorderObjectInfoArgs(cache);

            info.Bounds = new Rectangle(0, 0, width, 100);
            Rectangle textRect = BorderPainter.GetObjectClientRectangle(info);

            if (!(BorderPainter is EmptyBorderPainter) && !(BorderPainter is InplaceBorderPainter))
            {
                textRect.Inflate(-1, -1);
            }
            string text = string.Empty;

            if (Item.LinesCount == 0)
            {
                text = DisplayText;
                if (text != null && text.Length > 0)
                {
                    char lastChar = text[text.Length - 1];
                    if (lastChar == 13 || lastChar == 10)
                    {
                        text += "W";
                    }
                }
            }
            else
            {
                for (int i = 0; i < Item.LinesCount; i++)
                {
                    text += (string.IsNullOrEmpty(text) ? "" : Environment.NewLine) + "W";
                }
            }
            int height1 = CalcTextSizeCore(cache, text, textRect.Width).Height + 1;

            return((height1 + 100 - textRect.Bottom) + 1);
        }