Search code examples
c#winformscustom-controlsinfragisticsultrawingrid

using custom Ultragrid in winform


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.


Solution

  • Akh joooon, Thanks all.I found where the problem is...It was in OnPaint event. but not in CellClickAction or HeaderClickAction,It was in appearance properties,ActiveRowAppearance and SelectedRowAppearance.because i had set them too.I commented them and now every thing is fine.