Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
310
Problem in using custom Ultragrid
posted

Hi all,

I am new in using custom controls.

I have created a custom control in my winform application that inherited of ultragrid. I can not paste my codes here but i explain it below:

1. I have set some of properties such as CellClickAction and HeaderClickAction in OnPaint method before base.OnPaint(pe); command that changed the appearance and behavior of the ultragrid.

2. I have added a ContextMenuStrip control with 3 items (Ascending, Descending, None) that should use in Mouse Up event.

3. I have wrote an event handler for Mouse Up event of ultragrid that should find the caption of clicked header (if the user clicked on header) and do a 3way sorting by check and then change the SortIndicator property of that clicked column (if the left mouse button clicked) or show a ContextMenuStrip on that column (if the right mouse button clicked).

4. I have wrote an event handler for Item Clicked event of ContextMenuStrip that sort the grid based on clicked item.

Now the problem is when i want to use my grid in a form.Every things doing slowly and sometimes visual studio become locking or if for example i add a button to the form with MessageBox.Show(""); command on its clicked event handler and then run, and click on this button the form locking.

can any one tell me what is my mistake? please feel free to ask me about my question.

Parents
  • 469350
    Offline posted

    Hi,

    The only thing here that seems like it might cause a performance problem is using the OnPaint event. Unless you are using a flag so that you are setting these properties only once, the first time the grid paints, using this event to set property on the control is a very bad idea.

    In fact, I doubt that is the problem, since setting a property to the same value it was already set to is really a no-op. But that's the only thing you listed here that struck me as odd.

    My guess is that whatever the issue is, it's probably something else in your application that's causing it. But of course, I can't guess what that is, I can only see what you posted here. Try taking a look at the WinGrid Performance Guide for some advice on common performance issues.

     

Reply Children