diff --git a/PROMS/Volian.Controls.Library/VlnFlexGrid.cs b/PROMS/Volian.Controls.Library/VlnFlexGrid.cs index 9611e888..716f091d 100644 --- a/PROMS/Volian.Controls.Library/VlnFlexGrid.cs +++ b/PROMS/Volian.Controls.Library/VlnFlexGrid.cs @@ -21,6 +21,8 @@ namespace Volian.Controls.Library public delegate void VlnFlexGridEvent(object sender, EventArgs args); public delegate void VlnFlexGridCursorMovementEvent(object sender, VlnFlexGridCursorMovementEventArgs args); public delegate string VlnFlexGridPasteEvent(object sender, VlnFlexGridPasteEventArgs args); + public delegate void VlnFlexGridkeyEvent(object sender, KeyEventArgs args); + public partial class VlnFlexGrid : C1.Win.C1FlexGrid.C1FlexGrid { private C1SpellChecker _SpellChecker; @@ -194,6 +196,12 @@ namespace Volian.Controls.Library if (AdjustPastedText != null) return AdjustPastedText(sender, args); return args.Text; } + public event VlnFlexGridkeyEvent EnterKeyPressed; + public void OnEnterKeyPressed(object sender, KeyEventArgs args) + { + if (EnterKeyPressed != null) EnterKeyPressed(sender, args); + } + private TableCellEditor _tableCellEditor; public TableCellEditor TableCellEditor @@ -779,6 +787,16 @@ namespace Volian.Controls.Library _tableCellEditor.StepRTB_ArrowPressed(e.Control ? E_ArrowKeys.CtrlDown : E_ArrowKeys.Down); e.Handled = true; break; + case Keys.Enter: + //if (e.Shift) return; + //Select(Rows.Count - 1, 0); + //_tableCellEditor.StepRTB_ArrowPressed(E_ArrowKeys.Down); + //e.Handled = true; + if (!e.Control && !e.Shift && !e.Alt) + { + OnEnterKeyPressed(sender, e); + } + break; } } @@ -824,10 +842,10 @@ namespace Volian.Controls.Library } // it does, so draw background e.DrawCell(DrawCellFlags.Background); - // Please add a comment if this value needs to be changed - _rtf.Rtf = rtfText; if (rtfText.StartsWith(@"{\rtf")) { + // Please add a comment if this value needs to be changed + _rtf.Rtf = rtfText; // draw the RTF text if (e.Bounds.Width > 0 && e.Bounds.Height > 0) { @@ -874,6 +892,9 @@ namespace Volian.Controls.Library _rtf.Render(e.Graphics, new Rectangle(e.Bounds.X + 1, e.Bounds.Y + hAdjust, e.Bounds.Width - 3, e.Bounds.Height)); } } + else + _rtf.Text = rtfText; + // spell check unless (we're just measuring) if (!e.Measuring) { @@ -3303,6 +3324,17 @@ namespace Volian.Controls.Library idx = -1; } } while (idx != -1); + if (idxst < txtbuff.Length) + { + colPos = idxst - strow; + if (!dicCols.ContainsKey(colPos)) + dicCols.Add(colPos, curCol); + else if (curCol > dicCols[colPos]) + { + dicCols.Remove(colPos); + dicCols.Add(colPos, curCol); + } + } maxRow = curRow; // +1; curRow = 0; curCol = 0;