Ejemplo n.º 1
0
        public GeRectangle GetRichStringRange(RichString str)
        {
            Graphics gp = GetGDIGraphics();

            // Measure string.
            SizeF stringSize = new SizeF();

            FontManager manager = PtApp.ActiveDocument.GetFontManager();

            Font StrFont = null;
            if (str.FontID != -1)
                StrFont = manager.GetFont(str.FontID);
            else
                StrFont = manager.GetApplicationDefaultFont();

            // Device coordinates
            stringSize = gp.MeasureString(
                   str.GetString(), StrFont);

            // Defect - We should convert to World coordinates here.
            GeRectangle rec = new GeRectangle(new GePoint(0, 0)
                , new GePoint(stringSize.Width, stringSize.Height));
            return rec;
        }
Ejemplo n.º 2
0
        public static DisplayItemText GenDisplayItemText(DisplayItemList list, RichString str, GePoint position, GeRectangle rec)
        {
            //GeRectangle rec = PtApp.ActiveView.GetRichStringRange(str);

            DisplayItemText DLText = new DisplayItemText(str.GetString(), position,
                str.GetFont());
            DLText.Range = rec;

            if (list != null)
                list.AddItem(DLText);

            return DLText;
        }