Bug fix for B2011-080, added a check for all rows or all columns selected. Added variable to save background color, so that it could be restored if a Delete was aborted.

This commit is contained in:
John Jenko 2011-05-16 18:56:57 +00:00
parent ca6c3eab39
commit 5222423ac4

View File

@ -23,6 +23,12 @@ namespace Volian.Controls.Library
public partial class VlnFlexGrid : C1.Win.C1FlexGrid.C1FlexGrid public partial class VlnFlexGrid : C1.Win.C1FlexGrid.C1FlexGrid
{ {
public static GridCopyInfo MyCopyInfo = new GridCopyInfo(); public static GridCopyInfo MyCopyInfo = new GridCopyInfo();
private Color _DefaultCellBackgroundcolor;
public Color DefaultCellBackgroundcolor
{
get { return _DefaultCellBackgroundcolor; }
}
private Color _DefaultFixedBackgroundColor; private Color _DefaultFixedBackgroundColor;
public Color DefaultFixedBackgroundColor public Color DefaultFixedBackgroundColor
@ -609,6 +615,7 @@ namespace Volian.Controls.Library
this.Styles.Focus.BackColor = Color.LightCyan; this.Styles.Focus.BackColor = Color.LightCyan;
this.HighLight = HighLightEnum.WithFocus; this.HighLight = HighLightEnum.WithFocus;
_DefaultCellBackgroundcolor = this.StyleBackColor;
_DefaultFixedBackgroundColor = this.Styles.Fixed.BackColor; _DefaultFixedBackgroundColor = this.Styles.Fixed.BackColor;
this.AllowMerging = C1.Win.C1FlexGrid.AllowMergingEnum.Custom; this.AllowMerging = C1.Win.C1FlexGrid.AllowMergingEnum.Custom;
@ -2479,6 +2486,22 @@ namespace Volian.Controls.Library
this.AdjustGridControlSize(); this.AdjustGridControlSize();
} }
public bool AllRowsSelected()
{
int maxrow = Selection.r2;
foreach (CellRange cr in MySelection)
maxrow = Math.Max(maxrow, cr.r2);
return (Selection.r1 == 0 && maxrow == Rows.Count - 1);
}
public bool AllColumnsSelected()
{
int maxcol = Selection.c2;
foreach (CellRange cr in MySelection)
maxcol = Math.Max(maxcol, cr.c2);
return (Selection.c1 == 0 && maxcol == Cols.Count - 1);
}
public void RemoveSelectedColumn() public void RemoveSelectedColumn()
{ {
string msg = ""; string msg = "";
@ -2486,7 +2509,7 @@ namespace Volian.Controls.Library
CellRange saveCR = Selection; CellRange saveCR = Selection;
this.SelectionMode = SelectionModeEnum.ColumnRange; this.SelectionMode = SelectionModeEnum.ColumnRange;
//this.Select(this.Selection.r1, this.Selection.c1); //this.Select(this.Selection.r1, this.Selection.c1);
this.Select(0,Selection.c1,Rows.Count-1,Selection.c2); this.Select(0, Selection.c1, Rows.Count - 1, Selection.c2);
this.SelectionMode = SelectionModeEnum.Default; this.SelectionMode = SelectionModeEnum.Default;
if (Selection.c1 != Selection.c2) if (Selection.c1 != Selection.c2)
{ {
@ -2512,7 +2535,7 @@ namespace Volian.Controls.Library
CellRange saveCR = Selection; CellRange saveCR = Selection;
this.SelectionMode = SelectionModeEnum.RowRange; this.SelectionMode = SelectionModeEnum.RowRange;
//this.Select(this.Selection.r1, this.Selection.c1,); //this.Select(this.Selection.r1, this.Selection.c1,);
this.Select(Selection.r1,0,Selection.r2,Cols.Count-1); this.Select(Selection.r1, 0, Selection.r2, Cols.Count - 1);
this.SelectionMode = SelectionModeEnum.Default; this.SelectionMode = SelectionModeEnum.Default;
if (Selection.r1 != Selection.r2) if (Selection.r1 != Selection.r2)
{ {