Fixed ScrollToCenter logic for EditItems
Use ScrollToCenter logic when text is changed or textbox is resized.
This commit is contained in:
@@ -1510,9 +1510,11 @@ namespace Volian.Controls.Library
|
||||
//Console.WriteLine("CenterScroll {0} Current {1} Top {2} Bottom {3} Limit {4}", _MyItem.ItemID, _Panel.VerticalScroll.Value, Top, Bottom, _Panel.Height);
|
||||
if (Top >= 0 && Bottom <= MyStepPanel.Height) return;// Don't move if within screen.
|
||||
int scrollValue = MyStepPanel.VerticalScroll.Value + (Top - (MyStepPanel.Height / 2)); // calculate scroll center for the item
|
||||
// Limit scroll location within allowable values
|
||||
scrollValue = Math.Max(MyStepPanel.VerticalScroll.Minimum,Math.Min(MyStepPanel.VerticalScroll.Maximum,scrollValue));
|
||||
//Console.WriteLine("CenterScroll {0} Current {1} New {2} Min {3} Max {4}", _MyItem.ItemID, _Panel.VerticalScroll.Value, scrollValue, _Panel.VerticalScroll.Minimum, _Panel.VerticalScroll.Maximum);
|
||||
if (scrollValue >= MyStepPanel.VerticalScroll.Minimum && scrollValue <= MyStepPanel.VerticalScroll.Maximum) // If it is within range
|
||||
MyStepPanel.VerticalScroll.Value = scrollValue; // Center the item
|
||||
//if (scrollValue >= MyStepPanel.VerticalScroll.Minimum && scrollValue <= MyStepPanel.VerticalScroll.Maximum) // If it is within range
|
||||
MyStepPanel.VerticalScroll.Value = scrollValue; // Center the item
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Reference in New Issue
Block a user