Wolfgang Knauf7p said 1 year, 1 month ago:
hope that someone can help me. We have some quite complex flexgrids with a lot of styles, so we invented a helper class which encapsulates "on the fly creation of necessary styles". When breaking in debugger while we fill our grid, it often is stuck at "CellStyle.BackColor.get" or "CellStyle.ForeColor.get".
See attached screenshot with debugger stacktrace and "local variables" window.
According to the debugger stacktrace, a Graphics object is created, and this seems to be a costly operation. Is the creation of this Graphics object during "get" of the BackColor really necessary?
Attachments:You must be logged in to view attched files.Reeva1p said 1 year ago:
We have escalated your issue to the concerned team. We will get back to you soon on the same.
Reeva DhingraReeva1p said 1 year ago:
Our developers aren’t able to replicate the issue and they ain’t able to see any graphics object being created when getting/setting BackColor and ForeColor.
Could you please provide us with the portion of the code that produces this stack trace?
Reeva DhingraWolfgang Knauf7p said 1 year ago:
sorry for the delay. The issue of my original question is hard to reproduce. In our "real world" app, code execution is often located at "Graphics.FromHwnd", when I just click the "break into debugger" button during a longer operation.
But I managed to create a small sample, based on my "Stylehandler" helperclass from here: http://our.componentone.com/groups/winforms/flexgrid-for-winforms/forum/topic/5205
To reproduce, best set a break point in the "button1_Click" handler, e.g. at line 154. Then click the button – debugger should stop at the breakpoint.
NOW, it is time to create a breakpoint at "Graphics.FromHwnd": in the "Breakpoints" view, click the button "Import breakpoints from a file" and pick the file "stylehandlerbreakpoints.xml" in the attached samples. If all works as expected, there should be a breakpoint in "Graphics.FromHwnd".
When you continue debugging, you will find that this breakpoint is hit for every cell.
So it seems that a Graphics object is created each time the ForeColor or BackColor of a cell style is queried.
Note that the re-import of the breakpoints file seems to be necessary for each debugging run.
Attachments:You must be logged in to view attched files.C1_BernardoC7p said 12 months ago:
Hello Wolfgang. It’s been a long time!
I looked into this issue and found that the CellStyle constructor does call Graphics.FromHwnd.
The good news is I am pretty sure it only needs to do that in rare situations, so we should be able to skip that step in most cases.
The latest maintenance version of the grid, 686, has this optimization. It should be available for download shortly.
Thanks for bringing this up.AnswerWolfgang Knauf7p said 12 months ago:
Sounds promising, many thanks!
It will probably just be a minor improvement, but better than nothing .
WolfgangWolfgang Knauf7p said 11 months ago:
I see that the change is in .698. I applied the new version and hope that it slightly improves performance
WolfgangC1_BernardoC7p said 11 months ago:
Looking forward to your feedback Wolfgang.Thanks in advance.Viewing 8 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic.
FlexGrid for WinForms
Performance question: CellStyle.BackColor and .ForeColor
- ComponentOne Ultimate
- Studio Enterprise
- Studio for WinForms
- Studio for WPF
- Studio for Silverlight
- Studio for Windows Phone
- Studio for ASP.NET Wijmo
- Studio for iPhone
- Studio for Entity Framework
- Studio for ActiveX
- Studio for Compact Framework
- Studio for WinRT XAML
- Studio for WinJS
- Spread Studio for .NET
- Spread for WinForms
- Spread for ASP.NET
- Spread WPF-Silverlight
- Spread WinRT
- Spread COM
- Wijmo - HTML5/jQuery
- Maps Powered by Esri
- Studio for LightSwitch
- OLAP for WinForms
- OLAP for Silverlight
- OLAP for LightSwitch
As a leading component vendor in the Microsoft Visual Studio Industry Partner program, ComponentOne has been providing the widest range of Microsoft Visual Studio components, IDE platform development tools, and applications for over 22 years. ComponentOne product lines encompass custom WinForms, ASP.NET, WPF, Silverlight, Mobile, and COM components, documentation tools, and Web Parts for Microsoft Office SharePoint Server and Windows SharePoint Services.
Contact ComponentOne: 1.800.858.2739 | Pittsburgh: 412.681.4343
©2013 ComponentOne LLC All Rights Reserved.
All product and company names herein may be trademarks of their respective owners.
ComponentOne holds a license under Patent No. 5,490,216 (which expires on September 21, 2013)