几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   DirectDWG (http://www.dimcax.com/hust/forumdisplay.php?f=89)
-   -   【转帖】oddbmtext navigation (http://www.dimcax.com/hust/showthread.php?t=17560)

yang686526 2009-05-06 07:55 PM

【转帖】oddbmtext navigation
 
oddbmtext navigation
oddbmtext navigation
hello,
i'm trying to implement navigation through oddbmtext entity. say, user clicks somewhere inside mtext and i'd like to display caret there.
it's generally needed to calculate offset so to place caret before clicked character and not in the middle of it. i have trouble with such caret positioning, because i can't find methods those allow obtaining character's width or position in mtext. it seems, i only may obtain start and end points of mtext entity.
could someone, please, advise any algorithm for getting location of a definite character within oddbmtext entity?
hello gennadyv,
the mtext is complex object. the text size and font may be changed within mtext. try to see explodefragments() method. you may get the simple text fragments (possible it will be helpful). in any case there is no direct method for getting location of a definite haracter within oddbmtext entity.
best regards,
sergey z.


所有的时间均为北京时间。 现在的时间是 07:40 PM.