Fixes to DisplayItem being moved frequently and scrolling
This commit is contained in:
parent
0437f76f3a
commit
8833d00be1
@ -452,6 +452,7 @@ namespace Volian.Controls.Library
|
|||||||
_StepData = item.ActiveFormat.PlantFormat.FormatData.StepDataList[_Type%10000];
|
_StepData = item.ActiveFormat.PlantFormat.FormatData.StepDataList[_Type%10000];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
//this.Move += new EventHandler(DisplayItem_Move);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -532,6 +533,13 @@ namespace Volian.Controls.Library
|
|||||||
_Loading = false;
|
_Loading = false;
|
||||||
//// TIMING: vlnCSLARTB.TimeIt("CSLARTB Controls Add");
|
//// TIMING: vlnCSLARTB.TimeIt("CSLARTB Controls Add");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//void DisplayItem_Move(object sender, EventArgs e)
|
||||||
|
//{
|
||||||
|
// if(_MyItem != null)
|
||||||
|
// if(_MyItem.ItemID == 981)
|
||||||
|
// vlnStackTrace.ShowStack("DisplayItem_Move = {0} ({1},{2})", _MyItem.ItemID, Left, Top);// Show StackTrace
|
||||||
|
//}
|
||||||
//void _DisplayRTB_MouseClick(object sender, MouseEventArgs e)
|
//void _DisplayRTB_MouseClick(object sender, MouseEventArgs e)
|
||||||
//{
|
//{
|
||||||
// _DisplayRTB.Select();
|
// _DisplayRTB.Select();
|
||||||
@ -558,7 +566,12 @@ namespace Volian.Controls.Library
|
|||||||
//}
|
//}
|
||||||
public void AutoExpand()
|
public void AutoExpand()
|
||||||
{
|
{
|
||||||
Expand(_Type >= 20000);
|
if (CanExpand && Expanded == false)// TODO: May need to do some additional checking for subsections
|
||||||
|
{
|
||||||
|
//vlnStackTrace.ShowStack(">AutoExpand ID {0} - Can {1} Expanded {2}", _MyItem.ItemID, CanExpand, Expanded);
|
||||||
|
Expand(_Type >= 20000);
|
||||||
|
//Console.WriteLine("<AutoExpand ID {0} - Can {1} Expanded {2}",_MyItem.ItemID, CanExpand, Expanded);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private bool _Circle=false;
|
private bool _Circle=false;
|
||||||
public bool Circle
|
public bool Circle
|
||||||
@ -581,18 +594,23 @@ namespace Volian.Controls.Library
|
|||||||
public void ItemSelect()
|
public void ItemSelect()
|
||||||
{
|
{
|
||||||
_DisplayRTB.Focus();
|
_DisplayRTB.Focus();
|
||||||
_DisplayRTB.SelectAll();
|
_DisplayRTB.Select(0, 0);
|
||||||
if (CanExpand)
|
// if (CanExpand) AutoExpand(); // Expand the item if you can
|
||||||
AutoExpand(); // Expand the item if you can
|
CenterScroll();
|
||||||
int scrollValue = _Panel.VerticalScroll.Value + (Top - (_Panel.Height / 2)); // calculate scroll center for the item
|
|
||||||
if(scrollValue > _Panel.VerticalScroll.Minimum && scrollValue <= _Panel.VerticalScroll.Maximum) // If it isn't within range
|
|
||||||
_Panel.VerticalScroll.Value = scrollValue; // Center the item
|
|
||||||
}
|
}
|
||||||
public void ItemShow()
|
public void ItemShow()
|
||||||
{
|
{
|
||||||
_DisplayRTB.Focus();
|
_DisplayRTB.Focus();
|
||||||
|
CenterScroll();
|
||||||
|
}
|
||||||
|
private void CenterScroll()
|
||||||
|
{
|
||||||
|
//vlnStackTrace.ShowStack("CenterScroll {0} Current {1} Top {2} Bottom {3} Limit {4}", _MyItem.ItemID, _Panel.VerticalScroll.Value, Top, Bottom, _Panel.Height);// Show StackTrace
|
||||||
|
//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 <= _Panel.Height) return;// Don't move if within screen.
|
||||||
int scrollValue = _Panel.VerticalScroll.Value + (Top - (_Panel.Height / 2)); // calculate scroll center for the item
|
int scrollValue = _Panel.VerticalScroll.Value + (Top - (_Panel.Height / 2)); // calculate scroll center for the item
|
||||||
if(scrollValue > _Panel.VerticalScroll.Minimum && scrollValue <= _Panel.VerticalScroll.Maximum) // If it isn't within range
|
//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 >= _Panel.VerticalScroll.Minimum && scrollValue <= _Panel.VerticalScroll.Maximum) // If it is within range
|
||||||
_Panel.VerticalScroll.Value = scrollValue; // Center the item
|
_Panel.VerticalScroll.Value = scrollValue; // Center the item
|
||||||
}
|
}
|
||||||
private void vlnCSLARTB_Paint(object sender, PaintEventArgs e)
|
private void vlnCSLARTB_Paint(object sender, PaintEventArgs e)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user