Make current line read-only in text editor

I am trying to do command line cloning in C # so that I can familiarize myself with using IO. However, instead of one text body, I created two text boxes (one for the command and the other for "parameters") and a rich text box to view the result of the commands. It might sound confusing and the title might be misleading, but I didn't know how else to say it. Anyway, my question is, how do you make only the current line editable and the rest read-only? And how could I combine commands and options in two text boxes so that I don't need two separate text boxes? I spent 6 days trying to figure out the logic behind implementing this but got nothing.

Here is a picture of the form:

enter image description here

And here's what I want to make it look like:

enter image description here

+3


source to share


1 answer


I'm not sure if you can do this, but if it was me and it was a “do it now” situation (and it’s not at all), I would create a custom control to save the “screen”. This custom control should have an RTF or list box at the top and a text box below it.

I would remove the borders and wrap both of these controls in a panel with borders. This would simulate one control.

The textbox will validate the enter key in one of the keypress events, and the control itself will have events that can be handled by the parent control.



It might be hacky, but it will probably be what I would do at the last minute.

Oh as far as command and parameters, if you read the textbox as one value then split the string into a list or array, then you can define a radio button or some other conditional code that will know what to do with the parameters (index 1+) , depending on the value of the first element / index.

+1


source







All Articles