I'm using RichTextBox
Control in Winform
.
Recently I found a weird thing such like a Bug, I really can't find a way to fix it.
1.I have a
RichTextBox
inForm
.2.I clicked and selected some place in
RichTextBox
.3.I clicked any other place on desktop (just for
Deactivate
theForm
).[important]4.Then I use mouse wheel change the
RichTextBox
scroll bar to some place (but theForm
still inDeactivate
state).5.Now I click the
RichTextBox
after scrolled by mouse wheel. But you will find the current scrollbar position change to the old place.
This is the gif image for display the details:
I really hope the new clicked place will selected, and the scroll bar not changing to old selected position.
Is there any one know Why this is happening? Is there any way to fix this? Thanks.
Update:
I think maybe the problem is because the cursor in the RichTextBox
, If we could remove it, maybe it will not go back to the old cursor position when we click next time, Is there any way to do it? Like remove the cursor everytime when the RichTextBox
lost focus.
Another way might be possible is: turn current cursor position to the current scroll bar position every time when you move scroll bar or use mouse wheel.
Update2
I uploaded the project file and record video : https://drive.google.com/file/d/1rY_5mxKR6zOPqHBIOVaARee14-Ietise/view?usp=sharing
You could download and check.(I will delete it later.)
Version Windows 10 Professional
VersionNo 22H2
NT version 19045.2251