diff --git a/PROMS/Volian.Controls.Library/EditItem.cs b/PROMS/Volian.Controls.Library/EditItem.cs index 7fc086ee..0418899b 100644 --- a/PROMS/Volian.Controls.Library/EditItem.cs +++ b/PROMS/Volian.Controls.Library/EditItem.cs @@ -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 } /// diff --git a/PROMS/Volian.Controls.Library/RTBItem.cs b/PROMS/Volian.Controls.Library/RTBItem.cs index 74ee945b..22b71125 100644 --- a/PROMS/Volian.Controls.Library/RTBItem.cs +++ b/PROMS/Volian.Controls.Library/RTBItem.cs @@ -217,18 +217,21 @@ namespace Volian.Controls.Library //// TIMING: DisplayItem.TimeIt("CSLARTB Top"); InitializeComponent();// TODO: Performance 25% SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, null, false); + MyStepRTB.TextChanged += new EventHandler(MyStepRTB_TextChanged); } public RTBItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand, EditItem nextEditItem) { //// TIMING: DisplayItem.TimeIt("CSLARTB Top"); InitializeComponent();// TODO: Performance 25% SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, nextEditItem, false); + MyStepRTB.TextChanged += new EventHandler(MyStepRTB_TextChanged); } public RTBItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand, bool addFirstChld) { //// TIMING: DisplayItem.TimeIt("CSLARTB Top"); InitializeComponent();// TODO: Performance 25% SetupEditItem(itemInfo, myStepPanel, myParentEditItem, myChildRelation, expand, null, addFirstChld); + MyStepRTB.TextChanged += new EventHandler(MyStepRTB_TextChanged); } //private void SetupRTBItem(ItemInfo itemInfo, StepPanel myStepPanel, EditItem myParentEditItem, ChildRelation myChildRelation, bool expand, EditItem nextEditItem) //{ @@ -353,7 +356,14 @@ namespace Volian.Controls.Library void _MyStepRTB_Resize(object sender, EventArgs e) { if (MyStepPanel != null && this == MyStepPanel.SelectedEditItem) - MyStepPanel.ScrollControlIntoView(this); + ScrollToCenter(); + //MyStepPanel.ScrollControlIntoView(this); + } + void MyStepRTB_TextChanged(object sender, EventArgs e) + { + if (MyStepPanel != null && this == MyStepPanel.SelectedEditItem) + ScrollToCenter(); + //MyStepPanel.ScrollControlIntoView(this); } private Label lblHeader = null; private Label lblFooter = null;