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

@@ -158,17 +158,17 @@ namespace Volian.Controls.Library
}
}
}
void MyFlexGrid_SelChange(object sender, EventArgs e)
{
if (MyFlexGrid.Selection.c1 < 0 || MyFlexGrid.Selection.r1 < 0)
return;
if (MyFlexGrid.Selection.c1 >= MyFlexGrid.Cols.Count-1 || MyFlexGrid.Selection.r1 >= MyFlexGrid.Rows.Count-1)
return;
C1.Win.C1FlexGrid.CellRange cr = MyFlexGrid.GetEvenSelection();
rbnBorderSelectionPanel.InitializeBorder(MyFlexGrid.MyBorders, cr.r1, cr.c1, cr.r2, cr.c2);
if ((MyEditItem as GridItem).Initializing) return;
//C1.Win.C1FlexGrid.CellRange cr = MyFlexGrid.GetEvenSelection();
//rbnBorderSelectionPanel.InitializeBorder(MyFlexGrid.MyBorders, cr.r1, cr.c1, cr.r2, cr.c2);
rbnBorderSelectionPanel.InitializeBorder(MyFlexGrid, MyFlexGrid.Selection);
}
void _MyEditItem_Leave(object sender, EventArgs e)
{
// The following two lines were replaced by the third line so that the Ribbon KeyTips will work properly.
@@ -186,7 +186,6 @@ namespace Volian.Controls.Library
MyFlexGrid.SelChange -= new EventHandler(MyFlexGrid_SelChange);
}
}
void _MyEditItem_Enter(object sender, EventArgs e)
{
// The following two lines were replaced by the third line so that the Ribbon KeyTips will work properly.
@@ -205,7 +204,6 @@ namespace Volian.Controls.Library
Console.WriteLine("Turn on SelChange");
}
}
void MyFlexGrid_CopyOptionChanged(object sender, EventArgs args)
{
btnTblDgnPaste.Enabled = true;
@@ -234,7 +232,6 @@ namespace Volian.Controls.Library
break;
}
}
void _MyStepRTB_SelectionChanged(object sender, EventArgs e)
{
SetButtonAndMenuEnabling(false);
@@ -1929,13 +1926,10 @@ namespace Volian.Controls.Library
private void rbnBorderSelectionPanel_BordersChanged(object sender, EventArgs args)
{
C1.Win.C1FlexGrid.CellRange cr = MyFlexGrid.GetEvenSelection();
//foreach (C1.Win.C1FlexGrid.CellRange cr in MyFlexGrid.MySelection)
//{
MyFlexGrid.MyBorders.SetRange(cr.r1, cr.c1, cr.r2, cr.c2, rbnBorderSelectionPanel.TopBorder, rbnBorderSelectionPanel.InsideHorizontalBorder,
rbnBorderSelectionPanel.BottomBorder, rbnBorderSelectionPanel.LeftBorder, rbnBorderSelectionPanel.InsideVerticalBorder, rbnBorderSelectionPanel.RightBorder);
//}
MyEditItem.Invalidate();
//C1.Win.C1FlexGrid.CellRange cr = MyFlexGrid.GetEvenSelection();
MyFlexGrid.SetBorders(MyFlexGrid.Selection, rbnBorderSelectionPanel.TopBorder, rbnBorderSelectionPanel.InsideHorizontalBorder,
rbnBorderSelectionPanel.BottomBorder, rbnBorderSelectionPanel.LeftBorder, rbnBorderSelectionPanel.InsideVerticalBorder, rbnBorderSelectionPanel.RightBorder);
MyEditItem.Invalidate();
MyFlexGrid.Invalidate();
}
private void btnTblNoBorder_Click(object sender, EventArgs e)