简体   繁体   中英

c#: showing the selection of text in a textbox while another form is focused

I'm implementing a find and replace dialog; There is a main Windows From which has a textbox and another Windows Form (the find and replace dialog); Till now everything is OK except when I click my find button it does find and select the text in the textbox but to see the selection I have to activate(focus) on the parent window.

How can I show the selection in the parent window while not loosing the focus of child window?

while the focus is on the child dialog: 在此处输入图片说明

After setting the focus on the parent window: 在此处输入图片说明

Change the textbox HideSelection property to false.

You can see it here: https://msdn.microsoft.com/en-us/library/system.windows.forms.textboxbase.hideselection(v=vs.100).aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM