DataGridView Forecolor resets

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 4 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
dakotazinn
Posts: 20
Last visit: Wed Mar 31, 2021 7:12 am

DataGridView Forecolor resets

Post by dakotazinn »

To help you better we need some information from you.

*** Please fill in the fields below. If you leave fields empty or specify 'latest' rather than the actual version your answer will be delayed as we will be forced to ask you for this information. ***

Product: PowerShell Studio 2019 (64 Bit)
Build: v5.6.161
OS: Windows 10 Enterprise (64 Bit)
Build: v10.0.17763.0

*** Please add details and screenshots as needed below. ***

Occasionally, when opening a project containing a datagridview, if the form has a property set for ForeColor, it will apply that ForeColor to the datagridview DefaultCellStyle, even if the DefaultCellStyle's ForeColor has already been set.

Specifically, my Form's ForeColor is set to White, and I set the DefaultCellStyle to Black.
When I opened my project, the DefaultCellStyle's ForeColor was then reset to White again.

This has happened on multiple projects multiple times, and it constantly breaks my app releases because of white text on a white DGV cell background.
User avatar
Olga_B
Site Admin
Posts: 196
Last visit: Mon Mar 25, 2024 11:57 am

Re: DataGridView Forecolor resets

Post by Olga_B »

Thanks for reporting this issue.

We are investigating this and will update you as soon as we have more information.
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: DataGridView Forecolor resets

Post by davidc »

Unfortunately, this is issue within .NET itself. When you set the ForeColor of the Form, it overrides the default cell style of the grid.

To get around the issue, I recommend setting the color of the grid's default cell style within the form's Load event.
David
SAPIEN Technologies, Inc.
This topic is 4 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.