'Declaration
Public Class OwnerDrawCellEventArgs Inherits System.EventArgs
public class OwnerDrawCellEventArgs : System.EventArgs
'Declaration
Public Class OwnerDrawCellEventArgs Inherits System.EventArgs
public class OwnerDrawCellEventArgs : System.EventArgs
private void Form1_Load(object sender, EventArgs e) { _flex = new C1FlexGrid(); _flex.Dock = DockStyle.Fill; this.Controls.Add(_flex); OleDbConnection con = new OleDbConnection("provider=microsoft.jet.oledb.4.0;Data Source=" + Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\\ComponentOne Samples\\Common\\C1NWind.mdb"); DataTable ordersTable = new DataTable(); new OleDbDataAdapter("Select * from Products", con).Fill(ordersTable); _flex.DataSource = ordersTable; _flex.Cols["UnitsInStock"].Width = 200; _flex.DrawMode = DrawModeEnum.OwnerDraw; _flex.OwnerDrawCell += _flex_OwnerDrawCell; } private void _flex_OwnerDrawCell(object sender, OwnerDrawCellEventArgs e) { if(_flex.Cols[e.Col].Name=="UnitsInStock" && e.Row>0) { Brush brush = new SolidBrush(Color.Red); int cellValue=Convert.ToInt32(e.Text); e.Graphics.FillRectangle(brush,e.Bounds.X+5,e.Bounds.Y+5,cellValue,e.Bounds.Height-5); e.DrawCell(DrawCellFlags.Content); } }
System.Object
System.EventArgs
C1.Win.C1FlexGrid.OwnerDrawCellEventArgs