I have to implement the below in single custom cell in DatagridView Winform
Please click on link for output image
01
John Doe
Employee Name
Requirements:
- A cell with three fields. The first field is the row counter, the second database value, and the third is a display value.
- The third field will be visible; only when the user selects a particular cell.
Implementation :
After referring to the Microsoft documents and StackOverflow thread
- I have created a user control with three labels in it.
- I am overriding the paint method to paint the user control on the cell.
Issues:
- Can the following be implemented without overriding the paint().
- Is there a memory efficient Any better way to implement the same.
Code References :
Microsoft docs: https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.idatagridvieweditingcontrol?redirectedfrom=MSDN&view=netcore-3.1
Stackoverflow code thread: Display user control in DatagridViewCell