Attribute of a UserControl does not update the y
I've got a UserControl
(winforms) that is placed onto a Form (actually a Weifen.Luo.DockContent
, that again derives from the basic form). AutoScroll
is enabled for the form and the control can be moved on it by dragging around (more precisely by evaluating MouseDown
, MouseMove
, MouseUp
and updating the Location
).
Sometimes* when reaching the border (so that the form's plane must be further enlarged) updating the location of the control suddenly stops working; setting Location = ..
fails. For demonstration a snippet from the immediate window while debugging:
>Location
{X = 50 Y = 751}
IsEmpty: false
X: 50
x: 50
Y: 751
y: 751
But after updating...
>Location = new Point(30, 40);
>Location
{X = 30 Y = 751}
IsEmpty: false
X: 30
x: 30
Y: 751
y: 751
.. the y-Value still remains the same. How can this be? It seems as there is an LocationChanged-Handler attached (outside user code) thats works against me. Any hints?
*) allthough I wasn't able to find the exact cases when it happens, I found ways to reproduce it, eg when focusing a textbox on the control and then moving it to the edge or adding an (empty!) Load
event handler to the control - weird. I know this sounds more like a race condition. But currently I've got no idea where to go on searching.
Update: Every time the update fails, the Parent-Form's AutoScrollPosition
gets updated instead, resulting so that delta(AutoScrollPosition before and after) = delta(Location, newValueForLocation).
上一篇: 使用灵活的宽度自动调整UITableView的旋转大小
下一篇: UserControl的属性不会更新y