Wingrid marked Cross if you are not using screen for sometime
As the above screen shot displayed..above...my all grid marked cross ...automatically ...any idea ..why this happens ..?
Hi,
The big red X in an control means that an exception occurred in that control's OnPaint method.
This can be caused by a bug in the control, but more often it's the result of improper use of multiple threads in an application which causes the control to get out of synch with it's data source.
Is your application using threading?
Hi Mike,
We have 6 grids in this form.We are loading some user controls(containing images,progress bar) etc to the grid cells.We are also loading some image boxes (created dynamically) to the cells.When the initial load happens everything is going smoothly.
We have an option in this form for refreshing the grids as per the time interval set by user.For that we are using a timer.The refresh process also is happening properly for a couple of times.After that ,during 5th or 6th refresh, we are getting this problem.Once this happens,the application hangs but the timer tick event is not stopping.
Do you have any suggetions or solutions for this X mark issue?
Hello,
I am just checking about the progress of this issue
I believe we answer your question. Let me know if you have any further questions or I may close this case.
Thank you contacting us for this question.
Hi Prasant,
Obviously, I don't know all of the requirements of your application, but I still don't see why you need to use a completely different instance of various controls for every cell in the grid. If you have three different possible types of cells, then you only need three controls (or possibly as many as six if you allow editing) and three UltraControlContainerEditors and then you can re-use them for each cell that needs them.
In fact, if you really want this to be efficient, you only need one UltraControlContainerEditor and a single Control which can handle all three possibly types and display differently based on which type it is displaying. In other words, the RenderingControl could create or arrange controls within itself based on which type and the value it is displaying.
No luck.This solution is not applicable for us.Let me explain what we trying to achieve and how we are doing it.We have 5 grids in a form each displaying different data.The content in each cell can either be any of the following.1)User control 2)Combination of images and controls(label,progess bar etc).User control contains picture box,label,progess bar etc.Based on the value in the data set we are displaying the user controls or combination of images and controls (created dynamically).
We are binding these items to the container and then placing the container inside the cell.So the solution provided by Mike won't help us as data in each cell different.Mike suggested us to use the same container for displaying the same user control inside the grid.This won't help us as we are placing some other information inside the grid other than the user control.This information will be different for different cells eventhough the user control displayed is same.So we will have to use different containers for displaying the information.
We tried disposing the objects for each cell before rebinding the grid.Please find the methods mentioned below.
private static void DisposeObjects(UltraControlContainerEditor utraContainer) { if (utraContainer != null) { if ((utraContainer.RenderingControl.GetType().BaseType == typeof(UserControl))) { UserControl userControls = (UserControl)utraContainer.RenderingControl;
foreach (Control ctl in userControls.Controls) { if ((ctl.GetType() == typeof(TableLayoutPanel))) { TableLayoutPanel tblPnObj = (TableLayoutPanel)ctl; DisposeTableObjects(tblPnObj); } }
if (userControls.IsDisposed) { userControls.Dispose(); } } else { TableLayoutPanel tblpnl = (TableLayoutPanel)utraContainer.RenderingControl; DisposeTableObjects(tblpnl);
} utraContainer.Dispose(); GC.Collect(); } }
private static void DisposeTableObjects(TableLayoutPanel tblPnl) { Control cntrol = null; if (tblPnl != null) { foreach (Control ctl in tblPnl.Controls) { if ((ctl.GetType() == typeof(UltraPictureBox))) { UltraPictureBox picBoxObj = (UltraPictureBox)ctl; picBoxObj.Dispose(); }
if ((ctl.GetType() == typeof(UltraExpandableGroupBox))) { UltraExpandableGroupBox GroupBoxObj = (UltraExpandableGroupBox)ctl; GroupBoxObj.Dispose(); }
if ((ctl.GetType() == typeof(UltraButton))) { UltraButton buttonObj = (UltraButton)ctl; buttonObj.Dispose(); }
if ((ctl.GetType() == typeof(UltraLabel))) { UltraLabel buttonObj = (UltraLabel)ctl; buttonObj.Dispose(); } } }
}
Please suggest any other solution .
Thanks,
Prasant
I just wanted to know if you were able to solve your issue based on Mike's suggestions or you still need help. Just let me know.
Thank you
You don't need a different instance of the UltraControlContainerEditor or your control in order to display a different value in each cell of the grid. The UltraControlContainerEditor will use the grid cell's value and assign that value to the RenderingControl in order to paint the cell.
So unless you need to display some completely different UserControl in each cell of the grid, you should not have to do that.