c# - Adding buttons in relation to row -
i've trying add together 2 button rows have value 2, these button appear in relation datagridview.
if don't give them specific location appear @ top of datagridview, , when give them specific location still appear in relation datagridview.
how can create them appear in relation each row has value 2?
i want create buttons appear @ bottom or within specific row. i've been looking reply long time , can't find anything.
button buttonok = new button() { width = 100, height = 50 }; button buttoncancel = new button() { width = 100, height = 50 }; public void method1(datagridview datagridview1) { foreach (datagridviewrow row in datagridview1.rows) { if ((string)row.cells[2].value == ("1")) { row.defaultcellstyle.forecolor = color.green; } else if ((string)row.cells[2].value == ("2")) { row.defaultcellstyle.forecolor = color.blue; datagridview1.controls.add(buttonok); datagridview1.controls.add(buttoncancel); //buttonok.location = new point(00, 74); } else if ((string)row.cells[2].value == ("3")) { //do } } }
you can't add together buttons datagridview
. can, however, define column datagridviewbuttoncolumn
. of course of study problem button show in rows. implement custom datagridviewbuttoncolumn
shown in msdn thread. custom button column can hide buttons desired.
c#
No comments:
Post a Comment