This commit is contained in:
@@ -129,6 +129,10 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
_DPI = value;
|
||||
}
|
||||
//if (value == 120)
|
||||
// Console.WriteLine("Test");
|
||||
// if(!(TableCellEditor is StepRTB))
|
||||
// Console.WriteLine("{0}",TableCellEditor.GetType().Name);
|
||||
}
|
||||
}
|
||||
#region Grid Initialize
|
||||
@@ -1585,8 +1589,8 @@ namespace Volian.Controls.Library
|
||||
public void ClearSelectedCellText()
|
||||
{
|
||||
CellRange cr = this.Selection;
|
||||
DialogResult dr = MessageBox.Show("Clear Selected cells?", "Clear", MessageBoxButtons.YesNo);
|
||||
if (dr == DialogResult.Yes)
|
||||
//DialogResult dr = MessageBox.Show("Clear Selected cells?", "Clear", MessageBoxButtons.YesNo);
|
||||
//if (dr == DialogResult.Yes)
|
||||
cr.Clear(ClearFlags.Content);
|
||||
}
|
||||
public void SetupCellUserData()
|
||||
@@ -1616,7 +1620,11 @@ namespace Volian.Controls.Library
|
||||
this.MergedRanges.Add(this.Selection);
|
||||
this.Invalidate();
|
||||
}
|
||||
|
||||
public bool IsInMergeRange()
|
||||
{
|
||||
C1.Win.C1FlexGrid.CellRange sel = GetMergedRange(this.Selection.r1, this.Selection.c1);
|
||||
return MergedRanges.Contains(sel);
|
||||
}
|
||||
public void SplitSelection(bool bSplitCols)
|
||||
{
|
||||
C1.Win.C1FlexGrid.CellRange sel = this.GetMergedRange(this.Selection.r1, this.Selection.c1);
|
||||
@@ -1772,7 +1780,10 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
this.MergedRanges.Clear();
|
||||
foreach (CellRange r in crc)
|
||||
this.MergedRanges.Add(r);
|
||||
{
|
||||
if ((r.r1 != r.r2) || (r.c1 != r.c2))
|
||||
this.MergedRanges.Add(r);
|
||||
}
|
||||
}
|
||||
|
||||
private void AdjustMergedColumns(int col, bool left, bool removing)
|
||||
@@ -1839,7 +1850,10 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
this.MergedRanges.Clear();
|
||||
foreach (CellRange r in crc)
|
||||
{
|
||||
if ((r.r1 != r.r2) || (r.c1 != r.c2))
|
||||
this.MergedRanges.Add(r);
|
||||
}
|
||||
}
|
||||
|
||||
private bool RowIsInMergeRange(int row)
|
||||
@@ -1866,9 +1880,9 @@ namespace Volian.Controls.Library
|
||||
if (col >= 0)
|
||||
{
|
||||
CellRange cr = this.Selection;
|
||||
rtn = true;
|
||||
//rtn = true;
|
||||
int r = cr.r1;
|
||||
while (rtn && (r <= cr.r2))
|
||||
while (!rtn && (r <= cr.r2))
|
||||
{
|
||||
int idx = this.MergedRanges.IndexOf(col, r);
|
||||
rtn = (idx > -1);
|
||||
@@ -1969,67 +1983,113 @@ namespace Volian.Controls.Library
|
||||
|
||||
public void RemoveSelectedColumn()
|
||||
{
|
||||
this.SelectionMode = SelectionModeEnum.Column;
|
||||
this.Select(this.Selection.r1, this.Selection.c1);
|
||||
DialogResult dr = MessageBox.Show("Remove this column?", "Remove Column", MessageBoxButtons.YesNo);
|
||||
if (dr == DialogResult.Yes)
|
||||
RemoveColumns(this.Selection.r1, this.Selection.c1, 1);
|
||||
string msg = "";
|
||||
string title = "";
|
||||
CellRange saveCR = Selection;
|
||||
this.SelectionMode = SelectionModeEnum.ColumnRange;
|
||||
//this.Select(this.Selection.r1, this.Selection.c1);
|
||||
this.Select(0,Selection.c1,Rows.Count-1,Selection.c2);
|
||||
this.SelectionMode = SelectionModeEnum.Default;
|
||||
if (Selection.c1 != Selection.c2)
|
||||
{
|
||||
msg = "Remove selected columns?";
|
||||
title = "Delete Columns";
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = "Remove this column?";
|
||||
title = "Delete Column";
|
||||
}
|
||||
DialogResult dr = MessageBox.Show(msg, title, MessageBoxButtons.YesNo);
|
||||
if (dr == DialogResult.Yes)
|
||||
RemoveSelectedCells();//RemoveColumns(this.Selection.r1, this.Selection.c1, 1);
|
||||
else
|
||||
Select(saveCR);
|
||||
}
|
||||
|
||||
public void RemoveSelectedRow()
|
||||
{
|
||||
this.SelectionMode = SelectionModeEnum.Row;
|
||||
this.Select(this.Selection.r1, this.Selection.c1);
|
||||
DialogResult dr = MessageBox.Show("Remove this Row?", "Remove Row", MessageBoxButtons.YesNo);
|
||||
if (dr == DialogResult.Yes)
|
||||
this.RemoveRows(this.Selection.r1, this.Selection.c1, 1);
|
||||
string msg = "";
|
||||
string title = "";
|
||||
CellRange saveCR = Selection;
|
||||
this.SelectionMode = SelectionModeEnum.RowRange;
|
||||
//this.Select(this.Selection.r1, this.Selection.c1,);
|
||||
this.Select(Selection.r1,0,Selection.r2,Cols.Count-1);
|
||||
this.SelectionMode = SelectionModeEnum.Default;
|
||||
if (Selection.r1 != Selection.r2)
|
||||
{
|
||||
msg = "Remove selected rows?";
|
||||
title = "Delete Rows";
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = "Remove this row?";
|
||||
title = "Delete Row";
|
||||
}
|
||||
DialogResult dr = MessageBox.Show(msg, title, MessageBoxButtons.YesNo);
|
||||
if (dr == DialogResult.Yes)
|
||||
this.RemoveSelectedCells();//this.RemoveRows(this.Selection.r1, this.Selection.c1, 1);
|
||||
else
|
||||
Select(saveCR);
|
||||
}
|
||||
|
||||
private void RemoveRows(int strow, int stcol, int cnt)
|
||||
{
|
||||
bool mergedRow = false;
|
||||
for (int i = 0; i < cnt; i++)
|
||||
{
|
||||
if (this.RowIsInMergeRange(strow))
|
||||
{
|
||||
for (int cl = 0; cl < this.Cols.Count; cl++)
|
||||
//if (this.RowIsInMergeRange(strow))
|
||||
//{
|
||||
for (int cl = 0; cl < this.Cols.Count && !mergedRow; cl++)
|
||||
{
|
||||
int idx = this.MergedRanges.IndexOf(strow, cl);
|
||||
if (idx > -1)
|
||||
{
|
||||
CellRange cr = this.MergedRanges[idx];
|
||||
if (cr.r1 < cr.r2)
|
||||
this[cr.r1 + 1, cr.c1] = this[cr.r1, cr.c1];
|
||||
mergedRow = true;
|
||||
//this[cr.r1 + 1, cr.c1] = this[cr.r1, cr.c1];
|
||||
}
|
||||
cl++;
|
||||
}
|
||||
}
|
||||
//}
|
||||
this.Rows.Remove(strow);
|
||||
this.AdjustMergedRows(strow, false, true);
|
||||
if (mergedRow)
|
||||
{
|
||||
cnt++;
|
||||
mergedRow = false;
|
||||
}
|
||||
}
|
||||
this.AdjustGridControlSize();
|
||||
}
|
||||
|
||||
private void RemoveColumns(int strow, int stcol, int cnt)
|
||||
{
|
||||
bool mergedCol = false;
|
||||
for (int i = 0; i < cnt; i++)
|
||||
{
|
||||
if (this.ColIsInMergeRange(stcol))
|
||||
{
|
||||
for (int rw = 0; rw < this.Rows.Count; rw++)
|
||||
//if (this.ColIsInMergeRange(stcol))
|
||||
//{
|
||||
for (int rw = 0; rw < this.Rows.Count && !mergedCol; rw++)
|
||||
{
|
||||
int idx = this.MergedRanges.IndexOf(rw, stcol);
|
||||
if (idx > -1)
|
||||
{
|
||||
CellRange cr = this.MergedRanges[idx];
|
||||
if (cr.c1 < cr.c2)
|
||||
this[cr.r1, cr.c1 + 1] = this[cr.r1, cr.c1];
|
||||
mergedCol = true;
|
||||
//this[cr.r1, cr.c1 + 1] = this[cr.r1, cr.c1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//}
|
||||
this.Cols.Remove(stcol);
|
||||
this.AdjustMergedColumns(stcol, false, true);
|
||||
if (mergedCol)
|
||||
{
|
||||
cnt++;
|
||||
mergedCol = false;
|
||||
}
|
||||
}
|
||||
this.AdjustGridControlSize();
|
||||
}
|
||||
|
Reference in New Issue
Block a user