本文整理汇总了C#中XPTable.Models.Cell类的典型用法代码示例。如果您正苦于以下问题:C# Cell类的具体用法?C# Cell怎么用?C# Cell使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Cell类属于XPTable.Models命名空间,在下文中一共展示了Cell类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CellToolTipEventArgs
/// <summary>
/// Creates a CellToolTipEventArgs using the values from args.
/// </summary>
/// <param name="cell"></param>
/// <param name="location"></param>
public CellToolTipEventArgs(Cell cell, Point location)
: base(false)
{
this.Cell = cell;
this.Location = location;
this.ToolTipText = cell.ToolTipText;
}
示例2: CompareCells
/// <summary>
/// Compares two cells and returns a value indicating whether one is less
/// than, equal to or greater than the other.
/// </summary>
/// <param name="cell1"></param>
/// <param name="cell2"></param>
/// <returns></returns>
protected override int CompareCells(Cell cell1, Cell cell2)
{
int retVal = 0;
if (cell1.Checked && !cell2.Checked)
{
retVal = -1;
}
else if (!cell1.Checked && cell2.Checked)
{
retVal = 1;
}
// if the cells have the same checked value and the CheckBoxColumn
// they belong to allows text drawing, compare the text properties
// to determine order
if (retVal == 0 && ((CheckBoxColumn)this.TableModel.Table.ColumnModel.Columns[this.SortColumn]).DrawText)
{
// check for null data
if (cell1.Text == null && cell2.Text == null)
{
return 0;
}
else if (cell1.Text == null)
{
return -1;
}
retVal = cell1.Text.CompareTo(cell2.Text);
}
return retVal;
}
示例3: UpdateControl
public override Control UpdateControl(Cell cell, Control control)
{
// We either show a loading circle with the given colour, or just load an image.
Control newControl = null;
if (cell.Data is Color)
{
Color color = (Color)cell.Data;
if (control is LoadingCircle)
{
LoadingCircle lc = (LoadingCircle)control;
lc.Color = color;
}
}
else
{
// We are getting rid of the control now - so remove event handlers
if (control is LoadingCircle && this.ClickEventHandler != null)
((LoadingCircle)control).Click -= ClickEventHandler;
PictureBox pic = new PictureBox();
pic.Image = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + @"..\..\Resources\EmailRead.bmp");
newControl = pic;
}
return newControl;
}
示例4: DoColspan
private void DoColspan()
{
Table table = this.table; // The Table control on a form - already initialised
table.SelectionStyle = SelectionStyle.Grid;
table.BeginUpdate();
table.EnableWordWrap = true; // If false, then Cell.WordWrap is ignored
table.GridLines = GridLines.Rows;
TextColumn col1 = new TextColumn("col A", 100);
TextColumn col2 = new TextColumn("col B", 100);
TextColumn col3 = new TextColumn("col C", 100);
table.ColumnModel = new ColumnModel(new Column[] { col1, col2, col3 });
TableModel model = new TableModel();
Row row;
Cell cell;
// Add all 3 cells for row 1
row = new Row();
row.Cells.Add(new Cell("Short 1a"));
//row1.Cells.Add(new Cell("Short 1"));
cell = new Cell("This is long text that will just be truncated");
row.Cells.Add(cell);
row.Cells.Add(new Cell("Short 1c"));
model.Rows.Add(row);
// Add only 2 cells for row 2
row = new Row();
row.Cells.Add(new Cell("Short 2a"));
cell = new Cell("This is text that will go over to the next column");
cell.ColSpan = 2; // The row height will be increased so we can see all the text
row.Cells.Add(cell);
// We don't add the next cell
model.Rows.Add(row);
// Add all 3 cells for row 3
row = new Row();
row.Cells.Add(new Cell("Short 3"));
//row1.Cells.Add(new Cell("Short 1"));
cell = new Cell("This is a cell with some really long text that wraps more than the other text");
cell.WordWrap = true; // The row height will be increased so we can see all the text
row.Cells.Add(cell);
row.Cells.Add(new Cell("Short 3c"));
model.Rows.Add(row);
// Add only 2 cells for row 4
row = new Row();
row.Cells.Add(new Cell("Short 4"));
cell = new Cell("This is a cell with some really long text that wraps more than the other text");
cell.WordWrap = true; // Colspan and Wordwrap!!
cell.ColSpan = 2;
row.Cells.Add(cell);
model.Rows.Add(row);
this.table.TableModel = model;
this.table.EndUpdate();
}
示例5: CellEventArgsBase
/// <summary>
/// Initializes a new instance of the CellEventArgs class with
/// the specified Cell source, column index and row index
/// </summary>
/// <param name="source">The Cell that Raised the event</param>
/// <param name="column">The Column index of the Cell</param>
/// <param name="row">The Row index of the Cell</param>
public CellEventArgsBase(Cell source, int column, int row)
: base()
{
this.source = source;
this.column = column;
this.row = row;
}
示例6: AddEmailRows
private void AddEmailRows(TableModel table, bool read, string from, string sent, string subject, string preview)
{
Row row = new Row();
row.Cells.Add(new Cell()); // always starts off showing all subrows
row.Cells.Add(new Cell("", read ? _read : _unread));
row.Cells.Add(new Cell(from));
row.Cells.Add(new Cell(DateTime.Parse(sent)));
row.Cells.Add(new Cell("hi"));
table.Rows.Add(row);
// Add a sub-row that shows just the email subject in grey (single line only)
Row subrow = new Row();
subrow.Cells.Add(new Cell()); // Extra column for +/-
subrow.Cells.Add(new Cell());
Cell cell = new Cell(subject);
cell.ForeColor = Color.Gray;
cell.ColSpan = 3;
subrow.Cells.Add(cell);
row.SubRows.Add(subrow);
// Add a sub-row that shows just a preview of the email body in blue, and wraps too
subrow = new Row();
subrow.Cells.Add(new Cell()); // Extra column for +/-
subrow.Cells.Add(new Cell());
cell = new Cell(preview);
cell.ForeColor = Color.Blue;
cell.ColSpan = 3;
cell.WordWrap = true;
subrow.Cells.Add(cell);
row.SubRows.Add(subrow);
}
示例7: CanShow
/// <summary>
/// Called to determine whether this cell can be shown by this filter
/// </summary>
/// <param name="cell"></param>
/// <returns></returns>
public bool CanShow(Cell cell)
{
if (_allowedItems == null)
return true;
if (cell == null)
return true;
return _allowedItems.Contains(cell.Text);
}
示例8: GetCellHeight
/// <summary>
/// Returns the height that is required to render this cell. If zero is returned then the default row height is used.
/// </summary>
/// <param name="graphics"></param>
/// <param name="cell"></param>
/// <returns></returns>
public override int GetCellHeight(Graphics graphics, Cell cell)
{
if (cell != null)
{
this.Font = cell.Font;
// Need to set this.Bounds before we access Client rectangle
SizeF size = graphics.MeasureString(cell.Text, this.Font, this.ClientRectangle.Width, this.StringFormat);
return (int)Math.Ceiling(size.Height);
}
else
return 0;
}
示例9: CompareCells
/// <summary>
/// Compares two cells and returns a value indicating whether one is less
/// than, equal to or greater than the other.
/// </summary>
/// <param name="cell1"></param>
/// <param name="cell2"></param>
/// <returns></returns>
protected override int CompareCells(Cell cell1, Cell cell2)
{
// check for null data
if (cell1.Data == null && cell2.Data == null)
{
return 0;
}
else if (cell1.Data == null)
{
return -1;
}
else if (cell2.Data == null)
{
return 1;
}
Color color1 = (Color) cell1.Data;
Color color2 = (Color) cell2.Data;
if (color1.GetHue() < color2.GetHue())
{
return -1;
}
else if (color1.GetHue() > color2.GetHue())
{
return 1;
}
else
{
if (color1.GetSaturation() < color2.GetSaturation())
{
return -1;
}
else if (color1.GetSaturation() > color2.GetSaturation())
{
return 1;
}
else
{
if (color1.GetBrightness() < color2.GetBrightness())
{
return -1;
}
else if (color1.GetBrightness() > color2.GetBrightness())
{
return 1;
}
return 0;
}
}
}
示例10: DoWrap
private void DoWrap()
{
Table table = this.table; // The Table control on a form - already initialised
table.BeginUpdate();
table.EnableWordWrap = true; // If false, then Cell.WordWrap is ignored
table.SelectionStyle = SelectionStyle.Grid;
table.GridLines = GridLines.Rows;
TextColumn col1 = new TextColumn("col A", 100);
TextColumn col2 = new TextColumn("col B", 100);
table.ColumnModel = new ColumnModel(new Column[] { col1, col2 });
TableModel model = new TableModel();
Row row;
Cell cell;
row = new Row();
row.Cells.Add(new Cell("Short 1"));
//row1.Cells.Add(new Cell("Short 1"));
cell = new Cell("This is a cell with quite long text");
cell.WordWrap = true; // The row height will be increased so we can see all the text
row.Cells.Add(cell);
model.Rows.Add(row);
row = new Row();
row.Cells.Add(new Cell("Short 2"));
cell = new Cell("This is long text that will just be truncated");
cell.WordWrap = false; // Not needed - it is false by default
row.Cells.Add(cell);
model.Rows.Add(row);
row = new Row();
row.Cells.Add(new Cell("Short 3"));
//row1.Cells.Add(new Cell("Short 1"));
cell = new Cell("This is a cell with some really long text that wraps more than the other text");
cell.WordWrap = true; // The row height will be increased so we can see all the text
row.Cells.Add(cell);
model.Rows.Add(row);
row = new Row();
row.Cells.Add(new Cell("Short "));
cell = new Cell("This is long text that will just be truncated");
cell.WordWrap = false; // Not needed - it is false by default
row.Cells.Add(cell);
model.Rows.Add(row);
this.table.TableModel = model;
this.table.EndUpdate();
}
示例11: GetButtonRendererData
/// <summary>
/// Gets the ButtonCellRenderer specific data used by the Renderer from
/// the specified Cell
/// </summary>
/// <param name="cell">The Cell to get the ButtonCellRenderer data for</param>
/// <returns>The ButtonCellRenderer data for the specified Cell</returns>
protected ButtonRendererData GetButtonRendererData(Cell cell)
{
object rendererData = this.GetRendererData(cell);
if (rendererData == null || !(rendererData is ButtonRendererData))
{
rendererData = new ButtonRendererData();
this.SetRendererData(cell, rendererData);
}
return (ButtonRendererData) rendererData;
}
示例12: Add
/// <summary>
/// Adds the specified Cell to the end of the collection
/// </summary>
/// <param name="cell">The Cell to add</param>
public int Add(Cell cell)
{
if (cell == null)
{
throw new System.ArgumentNullException("Cell is null");
}
int index = this.List.Add(cell);
this.OnCellAdded(new RowEventArgs(this.owner, cell, index, index));
return index;
}
示例13: AddEmailRows
private void AddEmailRows(TableModel table, bool read, string from, string sent, string subject, string preview)
{
Row row = new Row();
//row.Alignment = RowAlignment.Top;
row.Cells.Add(new Cell()); // always starts off showing all subrows
row.Cells.Add(new Cell("", read ? _read : _unread));
Cell fro = new Cell(null); //from);
fro.WordWrap = true;
row.Cells.Add(fro);
Cell cellSent = new Cell(DateTime.Parse(sent));
if (sent == "5/4/2007 9:13")
{
cellSent.CellStyle = new CellStyle(ColumnAlignment.Left);
cellSent.CellStyle.LineAlignment = RowAlignment.Top;
}
row.Cells.Add(cellSent);
row.Cells.Add(new Cell("hi"));
row.RowStyle = new XPTable.Models.RowStyle();
row.RowStyle.Alignment = RowAlignment.Top;
table.Rows.Add(row);
// Add a sub-row that shows just the email subject in grey (single line only)
Row subrow = new Row();
subrow.Cells.Add(new Cell()); // Extra column for +/-
subrow.Cells.Add(new Cell());
subrow.RowStyle = new XPTable.Models.RowStyle();
subrow.RowStyle.Alignment = RowAlignment.Bottom;
Cell cell = new Cell(subject);
cell.ForeColor = Color.Gray;
cell.ColSpan = 3;
subrow.Cells.Add(cell);
row.SubRows.Add(subrow);
// Add a sub-row that shows just a preview of the email body in blue, and wraps too
subrow = new Row();
subrow.Cells.Add(new Cell()); // Extra column for +/-
subrow.Cells.Add(new Cell());
cell = new Cell(preview);
cell.ForeColor = Color.Blue;
cell.ColSpan = 3;
cell.WordWrap = true;
subrow.RowStyle = new XPTable.Models.RowStyle();
subrow.RowStyle.Alignment = RowAlignment.Bottom;
subrow.Cells.Add(cell);
row.SubRows.Add(subrow);
}
示例14: CompareCells
/// <summary>
/// Compares two cells and returns a value indicating whether one is less
/// than, equal to or greater than the other.
/// </summary>
/// <param name="cell1"></param>
/// <param name="cell2"></param>
/// <returns></returns>
protected override int CompareCells(Cell cell1, Cell cell2)
{
// check for null data
if (cell1.Data == null && cell2.Data == null)
{
return 0;
}
else if (cell1.Data == null)
{
return -1;
}
else if (cell2.Data == null)
{
return 1;
}
return Convert.ToDateTime(cell1.Data).CompareTo(Convert.ToDateTime(cell2.Data));
}
示例15: Add
/// <summary>
/// Adds the specified Cell to the end of the collection
/// </summary>
/// <param name="cell">The Cell to add</param>
public int Add(Cell cell)
{
if (cell == null)
{
throw new System.ArgumentNullException("Cell is null");
}
int index = this.List.Add(cell);
this.OnCellAdded(new RowEventArgs(this.owner, cell, index, index));
for (int i = 1; i < cell.ColSpan; i++)
{
this.Add(new Cell(string.Empty));
}
return index;
}