Hi All,
I am working with a textbox in C# which pulls a set of lines (stored in
the database as text_type, text_line_seq, text_desc). I am using three
text boxes to display previously entered text for selected users
(surgeons) to edit. Each type of line has a specific maximum length
(55,56, and 74 characters). The textbox must allow the users to format
their text (see EXAMPLE TEXT below) pretty much with just spacing.
I have the textbox properties set to multiline edit and I am appending
"\r\n" to each line as I pull it from the database and put it in the
textbox.
My problem is when a user typically adds a substantial amount of text
wordwrap will push "\r\n" down to the next line. When saving back to
the database I am using a foreach(string Line in Lines) to save the
data and the result is that the line runs over the maximum length
allowed for the line.
Ideally, I simply would like to insert Environment.Newline wherever
there is a wordwrap. I have been trying to use EM_FMTLINES (see
EM_FORMATLINES EXAMPLE) , but it has not worked so far. I am not
sure where I should call the method (SendMessage) and exactly whether
this will result in what I require.
I keep telling myself I must be making this more difficult than it
needs to be, but the solution has not appeared obvious so far.
Thanks for any suggestions.
Mike
EM_FORMATLINES EXAMPLE:
public static extern int SendMessage(IntPtr hWnd,int Msg,int
wParam,int lParam);
public const int EM_FMTLINES = 200;
SendMessage(tbxDiagnosis.Handle, EM_FMTLINES, 0, new IntPtr(0));
EXAMPLE TEXT:
NOTE: This procedure was done at the Hospital, in conjunction
with the Otolaryngology Service and Plastic Surgery. This patient is
having a free jejunal graft for replacement of his cervical esophagus,
and
the other parts of the procedure were performed by Dr. X and Dr.
Y.
ANESTHESIA: General endotracheal
ESTIMATED BLOOD LOSS: Less than 20 cc
DESCRIPTION OF PROCEDURE: Under satisfactory general anesthesia, after