c# - When is Datagridview's Paint and Cellpainting called? -
i have datagridview dgv
, let's 3 of columns want affect manually :
col1 : datagridviewtextboxcolumn, displaying number col2 : datagridviewtextboxcolumn, used color indicator, without text. backcolor will changed later. col3 : datagridviewimagecolumn
other columns binded respective datapropertyname
of underlying datasource
. 3 columns above not binded datapropertyname
, affected manually, example when want change image or color indicator.
every time affect datasource
, datasource rebind , dgv.invalidate()
update grid's graphic.
- when , how ask
dgv
take account manual values in 3 edited columns ? manually affect 3 above column insidedgv_cellpainting
. work cellpainting takes long time , decide remove it. tried putting them insidedgv_paint
(which used merging headers) not take color nor image.
with cellpainting : rectangles spaces between rows, filling background, separater between rows, boxes image , color, etc. 3 columns refering first column (index), color , image (in boxes) columns. other image constant.
without cellpainting: no row , column separation. created pseudo row separation setting grid's cell border horizontal.
- when
cellpainting
,paint
called? execution order , difference? rough understanding called when cell/grid "need repainted". notice called multiple times, not when callinvalidate()
when hover mouse on grid region.
thanks all.
Comments
Post a Comment