This commit is contained in:
Kathy Ruffing 2011-03-14 11:41:26 +00:00
parent 9cb6a48dee
commit ce76d5ed5f

View File

@ -19,6 +19,7 @@ namespace Volian.Controls.Library
{ {
public delegate void VlnFlexGridEvent(object sender, EventArgs args); public delegate void VlnFlexGridEvent(object sender, EventArgs args);
public delegate void VlnFlexGridCursorMovementEvent(object sender, VlnFlexGridCursorMovementEventArgs args); public delegate void VlnFlexGridCursorMovementEvent(object sender, VlnFlexGridCursorMovementEventArgs args);
public delegate string VlnFlexGridPasteEvent(object sender, VlnFlexGridPasteEventArgs args);
public partial class VlnFlexGrid : C1.Win.C1FlexGrid.C1FlexGrid public partial class VlnFlexGrid : C1.Win.C1FlexGrid.C1FlexGrid
{ {
//[XmlElement("MyBorders")] //[XmlElement("MyBorders")]
@ -77,6 +78,12 @@ namespace Volian.Controls.Library
{ {
if (CursorMovement != null) CursorMovement(sender, args); if (CursorMovement != null) CursorMovement(sender, args);
} }
public event VlnFlexGridPasteEvent AdjustPastedText;
internal string OnAdjustPastedText(object sender, VlnFlexGridPasteEventArgs args)
{
if (AdjustPastedText != null) return AdjustPastedText(sender, args);
return args.Text;
}
private TableCellEditor _tableCellEditor; private TableCellEditor _tableCellEditor;
public TableCellEditor TableCellEditor public TableCellEditor TableCellEditor
@ -441,7 +448,7 @@ namespace Volian.Controls.Library
ReadXml(sr); ReadXml(sr);
sr.Close(); sr.Close();
} }
} }
private void SetupGrid(int numrows, int numcols) //C1FlexGrid NewGrid() private void SetupGrid(int numrows, int numcols) //C1FlexGrid NewGrid()
{ {
// setup the default size of each cell in the table/grid // setup the default size of each cell in the table/grid
@ -1107,7 +1114,7 @@ namespace Volian.Controls.Library
// add adjustment for grid and cell borders // add adjustment for grid and cell borders
int newwidth = trtb.Width + 2; int newwidth = trtb.Width + 2;
if (newwidth > this.Cols[c].Width || AllowWidthShrink || r == 0) if (newwidth > (this.Cols[c].Width==-1?this.Cols.DefaultSize:this.Cols[c].Width) || AllowWidthShrink || r == 0)
this.Cols[c].Width = newwidth; this.Cols[c].Width = newwidth;
} }
} }
@ -2202,7 +2209,7 @@ namespace Volian.Controls.Library
trtb.Text = ""; trtb.Text = "";
else else
{ {
trtb.Rtf = (string)(arylst[aryidx++]); trtb.Rtf = OnAdjustPastedText(this, new VlnFlexGridPasteEventArgs((string)(arylst[aryidx++])));
trtb.AdjustWidthForContent(); trtb.AdjustWidthForContent();
} }
this[r, c] = trtb.Rtf; this[r, c] = trtb.Rtf;
@ -3866,4 +3873,17 @@ namespace Volian.Controls.Library
_Key = key; _Key = key;
} }
} }
public class VlnFlexGridPasteEventArgs
{
private string _Text;
public string Text
{
get { return _Text; }
set { _Text = value; }
}
public VlnFlexGridPasteEventArgs(string text)
{
_Text = text;
}
}
} }