vb.net - RightToLeft RichTextBox with pre-loaded text -


ok found strange type of bug in ms default richtextbox in vb.net 2008. if add line of text in richtextbox programmaticlly. there gape right side. see image below

ٰerror

here code

private sub button1_click_1(byval sender system.object, byval e system.eventargs) handles button1.click     dim f new form     dim rtb new richtextbox     f.width = 500     f.height = 500     rtb.righttoleft = windows.forms.righttoleft.yes     = 1 20         rtb.appendtext("بسم اللہ الرحمن الرحیم" & vbnewline)     next     rtb.dock = dockstyle.fill     f.controls.add(rtb)     f.show() end sub 

i can't explain it, try changing order of code richtextbox control added form before append text. worked me:

private sub btn1_click(byval sender object, byval e eventargs) handles btn1.click   dim f new form   f.width = 500   f.height = 500    dim rtb new richtextbox   rtb.name = "rtb"   rtb.dock = dockstyle.fill   rtb.righttoleft = righttoleft.yes    f.controls.add(rtb)   = 1 25     rtb.appendtext("بسم اللہ الرحمن الرحیم" & vbnewline)   next   f.show()    f.begininvoke(new action(of richtextbox)(addressof runfix), rtb) end sub  sub runfix(byval rtfcontrol richtextbox)   rtfcontrol.select(0, 0)   rtfcontrol.scrolltocaret() end sub 

i added hack begininvoke method performs scrolltocaret() call seems fix problem.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -