-
Hi C1,
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?
Best regards
Wolfgang
Attachments:
You must be logged in to view attched files.| #Hello,
We have escalated your issue to the concerned team. We will get back to you soon on the same.
Thanks,
Reeva Dhingra| #Hello,
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?
Thanks,
Reeva Dhingra| #Hi Reeva,
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/5205To 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.
Best regards
Wolfgang
Attachments:
You must be logged in to view attched files.| #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.
Answer| #Sounds promising, many thanks!
It will probably just be a minor improvement, but better than nothing
.Best regards
Wolfgang
| #I see that the change is in .698. I applied the new version and hope that it slightly improves performance
Best regards
Wolfgang
| #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
- Downloads
- Products
- 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
- ActiveReports
- 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
- IntelliSpell
- XapOptimizer
- Doc-To-Help
- DemoWorks
- Support
- Community
- About
- Store
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)

