DSShared.Lists.CustomListColumnCollection.Render C# (CSharp) Method

Render() public method

Renders this control to the supplied PaintEventArgs
public Render ( PaintEventArgs e, int rowHeight, int yOffset ) : void
e PaintEventArgs The instance containing the event data.
rowHeight int Height of the row.
yOffset int The y offset.
return void
		public void Render(PaintEventArgs e,int rowHeight,int yOffset)
		{
			e.Graphics.FillRectangle(headerBrush,offX,offY,tableWidth-1,headerHeight+rowSpace*2);

			int startX=0;
			for(int i=0;i<list.Count;i++)
			{
				CustomListColumn col = list[i] as CustomListColumn;
				if(col==overCol)
					e.Graphics.FillRectangle(Brushes.LightBlue,col.Left,offY,col.Width,headerHeight+rowSpace*2);

				//vertical lines
				e.Graphics.DrawLine(Pens.Black,col.Width+startX-colSpace+offX,offY,col.Width+startX-colSpace+offX,HeaderHeight+rowHeight+yOffset);
				e.Graphics.DrawString(col.Title,Font,foreBrush,new RectangleF(startX+offX,offY,startX+col.Width,Font.Height));//locs[i],0);
				//e.Graphics.DrawLine(Pens.Red,col.Left+col.Width,HeaderHeight+rowHeight+yOffset,col.Left+col.Width,Height);

				startX+=col.Width;
			}

			e.Graphics.DrawLine(Pens.Black,offX,offY+headerHeight+rowSpace*2,tableWidth-1,offY+headerHeight+rowSpace*2);

			switch(bStyle)
			{
				case BorderStyle.Fixed3D:
					System.Windows.Forms.ControlPaint.DrawBorder3D(e.Graphics,0,0,Width,Height,border);
					break;
				case BorderStyle.FixedSingle:
					System.Windows.Forms.ControlPaint.DrawBorder(e.Graphics,new Rectangle(0,0,Width,Height),Color.Black,ButtonBorderStyle.Solid);
					break;
			}
		}

Usage Example

Example #1
0
        /// <summary>
        /// Raises the <see cref="E:System.Windows.Forms.Control.Paint"></see> event.
        /// </summary>
        /// <param name="e">A <see cref="T:System.Windows.Forms.PaintEventArgs"></see> that contains the event data.</param>
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            int rowHeight = 0;

            for (int i = 0; i < items.Count; i++)
            {
                ObjRow row = (ObjRow)items[i];
                if (rowHeight + yOffset + row.Height >= 0 && rowHeight + yOffset < Height)
                {
                    row.Render(e, yOffset);
                }

                rowHeight += row.Height;
            }
            columns.Render(e, rowHeight, yOffset);
        }