Retained mode textbox

P

pyda001

I'm making a retianed mode drawing system. In my application I want to
make the users able to create textboxes similar to the ones used in
e.g. PowerPoint.

So far the application lets the user create the textboxes. My issue
arises when the user doubleclicks the textbox and I superimpose a
RichTextBox exactly over the extents of my retained mode textbox. The
user should be able to edit the text in the textbox, but no matter how
I tweak the RichTextBox it moves the text slightly compared to the
underlying text. I can also foresee an upcoming problem when I let the
user have two or more fonts in the same textbox.

Anyone have dealt with this before? Is the RichTextBox the right
control to use or should I recreate this entire control from scratch?


- Peder -
 
G

Guest

Why not just replace the textboxes with RichTextBoxes?

Alternatively, bring up a small form to allow users to enter text, then
populate the text boxes with the results of this operation?

Personally, I'd try to just use RTB's everywhere. But I'm lazy.
 
P

pyda001

Maybe I wasn't making myself clear enough so I'll try to explain once
more.

I'm creating a retained mode drawing system. A textbox in this context
is not a control, but a GDI+ drawn element using DrawRectangle(),
FillRectangle, and DrawString(). However, it seems text rendering is
different in GDI+ and inside the RichTextBox. It either doesn't fit
right, wraps around the wrong way, or has the wrong width compared to
DrawString.

I picture I could create a control that behaves like a RichTextBox and
does my work, but this is a lot of work if there is a simpler solution.
I'm sure this has been solved before, hence this post.

Anyone?


- Peder -
 
G

Guest

Well, I don't think its either a simple problem or that anybody else has
tried to do this before. I think your best bet would be to pop up a form
that takes the imput rather than try to fool the user into thinking they are
manipulating the text on the image itself. Good luck on the prob, tho.
 
P

pyda001

Well, I never said I thought it would be a simple problem. On the
contrary. However, the dialog-box solution is exactly what I want to
avoid. I'm making a "presentation program light" as my thesis project
and would like to mimic the PowerPoint-style textboxes. They should
support in-place editing or the interface will become a joke. So far
I'm just out fishing for ideas on how to do this. I can picture
developing a new control which behaves almost exactly like the
RichTextBox, but that uses drawstring to refresh the graphics instead
of the built-in rendering of the RichTextBox. However, this will mean a
hellofalot of work if you take into account all the different events,
mouse selecting of text, cutting, copying, pasting, indenting,
bulleting, and so on.


- Peder -
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top