Inherit RichTextBox and complete the code editor. It supports syntax highlighting and line number display (2 );

Source: Internet
Author: User

Currently, the input line blinks to solve the problem.

In order to process the highlighted match, the original text is replaced directly with selectionstart and selectedtext in RT;

First, the text to be processed is processed, saved to the variable in the RTF format, and replaced with the original text position at a time. The effect is improved, but sometimes flashes because the selectionlength range is too large; when a row is changed in the middle, the original row and the new row are replaced, and the blinking is more serious.

After processing a line by line, save a line of text as an RTF variable and use the wm_setredraw (& Hb) message of sendmessage;

Disable refresh;

Sendmessage (Me. Handle, wm_setredraw, 0, 0)
Enable refresh;
Sendmessage (Me. Handle, wm_setredraw, 1, 0)

 

'Return to textbox <br/>'. Do not refresh. Clear all lines of text in the range. <br/> me. rt_allowrefresh (false) <br/> mybase. selectionstart = _ first <br/> mybase. selectionlength = _ length <br/> mybase. selectedtext = "" <br/> mybase. selectionlength = 0 <br/> mybase. selectionstart = _ first </P> <p> 'refresh allowed to add text of each row. <br/> me. rt_allowrefresh (true) <br/> mybase. selectedrtf = m_buff.tostring

 

Refreshing is prohibited when the original text is cleared. The text of the specified line of rt is deleted. However, because rt is not refreshed, it seems that the text still exists, refresh is enabled, and the text is returned, in this way, the text is updated quickly, but the RT is refreshed again, so it seems that only the text color changes.

The above refresh is allowed in the second reset insert point position, because the text will not flash before the refresh is allowed in the second reset insert point position, but the line is at the beginning, there is always a insert point cursor ("|") shadow flashing (no text input );

By now, a complete code editor is complete.

 

Complete source code download: http://download.csdn.net/detail/xiaoid/5088417

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.