- Remove Comment
- Set Forecolor to backcolor on a cell being edited. - Verify that the Col is within range before accessing cell contents Support for volian border formats
This commit is contained in:
parent
24b023c2f7
commit
9befc92794
@ -183,7 +183,7 @@ namespace Volian.Controls.Library
|
|||||||
void MyStepRTB_VisibleChanged(object sender, EventArgs e)
|
void MyStepRTB_VisibleChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
MyStepRTB.EditMode = MyStepRTB.Visible;
|
MyStepRTB.EditMode = MyStepRTB.Visible;
|
||||||
Console.WriteLine("GridItem: EditMode = {0}", MyStepRTB.EditMode);
|
//Console.WriteLine("GridItem: EditMode = {0}", MyStepRTB.EditMode);
|
||||||
}
|
}
|
||||||
void MyStepRTB_ReturnToEditor(object sender, EventArgs args)
|
void MyStepRTB_ReturnToEditor(object sender, EventArgs args)
|
||||||
{
|
{
|
||||||
@ -199,14 +199,18 @@ namespace Volian.Controls.Library
|
|||||||
void MyStepRTB_EditModeChanged(object sender, EventArgs args)
|
void MyStepRTB_EditModeChanged(object sender, EventArgs args)
|
||||||
{
|
{
|
||||||
if (MyStepRTB.EditMode)
|
if (MyStepRTB.EditMode)
|
||||||
MyFlexGrid.Styles["Focus"].BackColor = MyFlexGrid.Styles["Highlight"].BackColor = Color.SkyBlue;
|
MyFlexGrid.Styles["Focus"].ForeColor = MyFlexGrid.Styles["Focus"].BackColor =
|
||||||
|
MyFlexGrid.Styles["Highlight"].ForeColor = MyFlexGrid.Styles["Highlight"].BackColor = Color.SkyBlue;
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
MyFlexGrid.Styles["Focus"].ForeColor = MyFlexGrid.Styles["Highlight"].ForeColor = Color.Black;
|
||||||
MyFlexGrid.Styles["Focus"].BackColor = MyFlexGrid.Styles["Highlight"].BackColor = Color.LightCyan;
|
MyFlexGrid.Styles["Focus"].BackColor = MyFlexGrid.Styles["Highlight"].BackColor = Color.LightCyan;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private string _OrigRtf; // used to store original rtf to allow for 'escape' key restore
|
private string _OrigRtf; // used to store original rtf to allow for 'escape' key restore
|
||||||
void MyFlexGrid_SelChange(object sender, EventArgs e)
|
void MyFlexGrid_SelChange(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (MyFlexGrid.Selection.IsSingleCell)
|
if (MyFlexGrid.Selection.IsSingleCell && MyFlexGrid.Row >= 0 && MyFlexGrid.Col >= 0)
|
||||||
_OrigRtf = MyFlexGrid[MyFlexGrid.Row, MyFlexGrid.Col].ToString();
|
_OrigRtf = MyFlexGrid[MyFlexGrid.Row, MyFlexGrid.Col].ToString();
|
||||||
}
|
}
|
||||||
void MyStepRTB_KeyDown(object sender, KeyEventArgs e)
|
void MyStepRTB_KeyDown(object sender, KeyEventArgs e)
|
||||||
@ -338,7 +342,8 @@ namespace Volian.Controls.Library
|
|||||||
public override void SetFocus() { MyFlexGrid.Focus();}
|
public override void SetFocus() { MyFlexGrid.Focus();}
|
||||||
public override void SaveContents()
|
public override void SaveContents()
|
||||||
{
|
{
|
||||||
MyFlexGrid[MyFlexGrid.Row, MyFlexGrid.Col] = MyStepRTB.Rtf;
|
if(MyFlexGrid.Row >= 0 && MyFlexGrid.Col >= 0) // Only if a Cell is Selected
|
||||||
|
MyFlexGrid[MyFlexGrid.Row, MyFlexGrid.Col] = MyStepRTB.Rtf;
|
||||||
}
|
}
|
||||||
public override bool CanExpand { get { return false; } set { ;} }
|
public override bool CanExpand { get { return false; } set { ;} }
|
||||||
public override void HandleResize() { ;} // DONE
|
public override void HandleResize() { ;} // DONE
|
||||||
|
@ -340,17 +340,30 @@ namespace Volian.Controls.Library
|
|||||||
|
|
||||||
// and draw border last
|
// and draw border last
|
||||||
e.DrawCell(DrawCellFlags.Border);
|
e.DrawCell(DrawCellFlags.Border);
|
||||||
|
// This can be used to draw more specific borders
|
||||||
|
// DrawCellBorder(e.Graphics, e.Bounds,e.Row,e.Col);
|
||||||
// we're done with this cell
|
// we're done with this cell
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void DrawCellBorder(Graphics graphics, Rectangle rectangle, int row, int col)
|
||||||
|
{
|
||||||
|
int x1 = rectangle.Left;
|
||||||
|
int y1 = rectangle.Top;
|
||||||
|
int x2 = rectangle.Right - 1;
|
||||||
|
int y2 = rectangle.Bottom - 1;
|
||||||
|
if (row == 0)
|
||||||
|
graphics.DrawLine(Pens.Black, x1, y1, x2, y1);
|
||||||
|
if (col == 0)
|
||||||
|
graphics.DrawLine(Pens.Black, x1, y1, x1, y2);
|
||||||
|
graphics.DrawLine(Pens.Black, x1, y2, x2, y2);
|
||||||
|
graphics.DrawLine(Pens.Black, x2, y1, x2, y2);
|
||||||
|
// Double line attribute the Bottom of the first row
|
||||||
|
// if(row == 0)
|
||||||
|
// graphics.DrawLine(Pens.Black, x1, y2-2, x2, y2-2);
|
||||||
|
}
|
||||||
#endregion //Grid Initialize
|
#endregion //Grid Initialize
|
||||||
|
|
||||||
#region Grid and Cell Styles
|
#region Grid and Cell Styles
|
||||||
|
|
||||||
|
|
||||||
public void ChangeBackgroundColor(string bckgndColor)
|
public void ChangeBackgroundColor(string bckgndColor)
|
||||||
{
|
{
|
||||||
CellRange cr = this.Selection;
|
CellRange cr = this.Selection;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user