开发者

text in paint like application

开发者 https://www.devze.com 2023-03-13 07:39 出处:网络
Hope I can make the question clear. I am working on a paint like application where users can add different objects and also text. The way to add text is that we show a dialog where user can enter tex

Hope I can make the question clear.

I am working on a paint like application where users can add different objects and also text. The way to add text is that we show a dialog where user can enter text and then that text is added to the draw area. Now we want that text should be added in the same way as in Power Point. A user clicks any where in the draw area, a rectangular text entering area is shown, where user can enter text, format it, move the rectangle to move the text and then click outside to enter the text on the drawing area. Since the paint event of the draw area is called and every object is added to the draw area using graphics and paint,开发者_如何转开发 what is the best way to add text using the interface as I explained above.

Any suggestions would be appreciated.


Your best option is to place a TextBox as a child control and that will allow the user to modify the text as required. Once they finish changing the text you then remove the text box and draw the string instead. If they click the text becaues they want to change it then you put the text box back again so they can edit it.

0

精彩评论

暂无评论...
验证码 换一张
取 消