Initialize Borders from FlexGrid selection

Eliminate SelChange funtions during Initialization
Eliminate Moving GridItem to the Left and Right on selection
Fixed a bug where SelectedEditItem was null
Eliminate SelChange funtions during Initialization
Use FlexGrid CellRange (Selection) to Get and Set Range Borders
Added Unknown value to GridLinePattern enum
Set Range Borders based upon CellRange (Selection)
This commit is contained in:
Rich
2011-03-22 15:05:22 +00:00
parent 81b22109e6
commit a03970cd09
6 changed files with 95 additions and 19 deletions

View File

@@ -92,6 +92,38 @@ namespace Volian.Controls.Library
get { return _MyItemInfo; }
set { _MyItemInfo = value; }
}
public void SetBorders(CellRange myRange,
GridLinePattern top, GridLinePattern middle, GridLinePattern bottom,
GridLinePattern left, GridLinePattern center, GridLinePattern right)
{
for (int r = myRange.r1; r <= myRange.r2; r++)
for (int c = myRange.c1; c <= myRange.c2; c++)
{
CellRange cr = GetMergedRange(r, c);
if (r == myRange.r1) // Top Border
if(top != GridLinePattern.Mixed) MyBorders.HorizontalLines[cr.r1, cr.c1]=top;
if (r == myRange.r1 && c == myRange.c1) // Left Border
if(left != GridLinePattern.Mixed) MyBorders.VerticalLines[cr.r1, cr.c1]=left;
if (r == myRange.r2) // Bottom Border
if(bottom != GridLinePattern.Mixed) MyBorders.HorizontalLines[cr.r2 + 1, cr.c2]=bottom;
if (r == myRange.r2 && c == myRange.c2) // Right Border
if(right != GridLinePattern.Mixed) MyBorders.VerticalLines[cr.r2, cr.c2 + 1] = right;
if (r == cr.r1 && c == cr.c1) // Look for inside lines
{
if (cr.r1 > myRange.r1 && cr.r1 < myRange.r2) // Inside Horizontal Top
if(middle != GridLinePattern.Mixed) MyBorders.HorizontalLines[cr.r1, cr.c1]=middle;
if (cr.r2 > myRange.r1 && cr.r2 < myRange.r2) // Inside Horizontal Bottom
if(middle != GridLinePattern.Mixed) MyBorders.HorizontalLines[cr.r2 + 1, cr.c2]=middle;
if (cr.c1 > myRange.c1 && cr.c1 < myRange.c2) // Inside Vertical Left
if(center != GridLinePattern.Mixed) MyBorders.VerticalLines[cr.r1, cr.c1]=center;
if (cr.c2 > myRange.c1 && cr.c2 < myRange.c2) // Inside Vertical Right
if(center != GridLinePattern.Mixed) MyBorders.VerticalLines[cr.r2, cr.c2 + 1]=center;
}
c = cr.c2;//Skip to the end of the merged cells
}
}
[XmlIgnore]
public bool HasVScroll
{