Good day to all! There is a need to create your own control. The bottom line: There is a code that hits text on sentences. It seems to be beating correctly, at least I have not yet encountered problems. All received offers must be placed in the text field. Each sentence should also be circled by a “frame” line (the color for which you can set depending on the type and other characteristics of the sentence), but that’s not all. If the text is divided into sentences incorrectly, it should be possible to drag the right border of any sentence to a certain position, after which all instances of the class "sentence" affected by the drag should change the "text" field accordingly. It seems to be clear that it is necessary to dig in the direction of usercontrol, but how to draw the framework for the proposals is not clear. Drawing stupidly over the usual text field is, in my opinion, not an option, because When scrolling, the scrollbar will have to redraw everything.

Question: 1. What are the ideas about implementing the control or solving the problem as a whole? 2. Which way to dig?

Thank you for your attention) And if you also throw a clever thought, so do thousands of thanks!

  • 2
    WinForms or WPF? - VladD
  • Here I still think about this. In general, I came across only winForms, but apparently in wpf this will be much easier to implement. - sky49rus
  • one
    " There is a code that hits the text on sentences. It seems to be right, at least I haven’t met any problems yet. " - Hold the unit test: The Слон сказал: "Привет. Добро пожаловать!" (Вредный был слон, хоть и... Приветливый. Приветливый — это фамилия у него такая была.) "Но..." — задумался тигр, — "я не хочу никого жаловать, "толстокожая скотина". Тигр (его звали Васильев А. П.) был воспитанным, поэтому съел слона и больше не задавался вопросами: жаловать? не жаловать? Такая вот Юж. Африка дикая. А ведь 1000 г. до н. э. шёл! Слон сказал: "Привет. Добро пожаловать!" (Вредный был слон, хоть и... Приветливый. Приветливый — это фамилия у него такая была.) "Но..." — задумался тигр, — "я не хочу никого жаловать, "толстокожая скотина". Тигр (его звали Васильев А. П.) был воспитанным, поэтому съел слона и больше не задавался вопросами: жаловать? не жаловать? Такая вот Юж. Африка дикая. А ведь 1000 г. до н. э. шёл! and then - Athari
  • Discord, no offense, but your unit test is no good. My code will pass it on 100+. The code is intended for more complex texts containing abbreviations (+ nomenclature abbreviations in technical documentation) of different types. I will not throw here - the shortest text stupidly does not fit. The only drawback of the algorithm is that it does not recognize paragraph headings (without a dot at the end) as a separate sentence, but considers it to be the beginning of the next one, if any. If the next is not, then put in the end point. This glitch is relatively recently noticed, but it is not about him or the algorithm at all - sky49rus
  • 2
    @ sky49rus I would dig in the direction of WPF and look at how the selection is implemented there, and how it can be calculated where the text is located. The bonus is that in WPF, the selection is crocheted (translucent rectangles over text), and all the code is available, but in WinForms, the selection is normal, but all controls are implemented at the axis level, and in .NET only thin wrappers. For your task, WPF with its clumsy text selections - what the doctor ordered, already half of the problem is solved, it remains only to make the movement of the borders your way. True, there is a risk that the code is internal, but better so than without the code. - Athari

0