0

I'm looking for a way to display and edit text inside a custom shaped box (e.g. a circle.) The text needs to use as much of the allowed space as possible, so just positioning an edit box inside the shape is not good enough.

Requirements:

  1. Given a GraphicsPath and a string, draw the text within the path. If the text overflows, truncate or raise an event.
  2. Allow the user to edit text within the GraphicsPath.
  3. All the intelligence of the standard text box with respect to word breaks, word wrap, localization.

There don't seem to be any controls out there that fit these requirements. It probably requires low-level line layout APIs to accomplish this, and I can't find documentation in MSDN about such API's in Windows either.

This is for a high precision tool, so we're willing to put in a lot of effort to get what we need.

Thanks in advance!

4

1 回答 1

0

因为您提到它是用于高精度工具,所以我会完全避免依赖内置的 TextRenderer 方法,因为它们在准确性和一致性方面存在问题。

至于对编辑控件进行整形,是指将其形状从矩形更改为圆形,还是控件仍会占用矩形区域?如果是前者,您可以更改 Region 属性或 P/Invoke SetWindowRgn 系列。

于 2009-06-02T17:07:26.580 回答