question

Mike-5380 avatar image
0 Votes"
Mike-5380 asked karenpayneoregon answered

How to display a usercontrol in DataGridView C#

Hello,

in my program i have a DataGridView and i want to have a column with multiple custom buttons (e.g. edit button, delete button, copy button).
E.g.
143161-grafik.png



How can i do this?

Thanks in advance

dotnet-csharpwindows-formsdotnet-runtime
grafik.png (9.3 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

karenpayneoregon avatar image
0 Votes"
karenpayneoregon answered

To do this requires a bit of an effort to draw each image in cell paint event while without an image like the one I did below is a good deal easier.

In the screenshot below the button only appear on the current row and adding additional columns is easy. Base code is here in the following repository.

143133-dgvbuttons.png

If you really want a clean/polish look than check out telerik grid here.



dgvbuttons.png (56.7 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.