[DevExpress Support Team: CLONED FROM T281759: The main form flickers when closing an edit form in XtraGrid]
Hi
Problem discussed in the T281759 still exist when I put one form in container control (see attached sample project). I see flickers more often when close edit form via Esc button.
The main form flickers on closing an edit form in XtraGrid that is placed inside another Form, which is not a top-level window
Answers approved by DevExpress Support
We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.
Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.
- v15.1.8Download Official Update
I have passed this ticket to our R&D team for research. In the meantime, I would like to ask you describe your scenario in greater detail. Please clarify why you cannot use the UserControl or display the Form as a MDI child. Possibly, we can suggest an alternative approach that will completely satisfy your requirements.
I plan to use Panel to show different form. So, UserControl is not for this purpose. Run form as MDI child is that I want, but I not want to see any border around MDI child form.
Do you mean that you want to display the view sometimes as a stand-alone Form and sometimes put it inside the container control? The UserControl can be very convenient in this case:
public class Form1 :XtraUserControl { public Form1() { this.InitializeComponent(); } } public static void ShowViewAsStandAloneWindow(XtraUserControl view) { Form container = new Form(); view.Dock = DockStyle.Fill; view.Parent = view; container.Show(); } public static void PutViewInsideContainer(XtraUserControl view, PanelControl container) { view.Dock = DockStyle.Fill; view.Parent = container; }
Yes, this way also correct. But already exist in project hierarchy of classes, where base classes divide into MDI form, standard form and Dialog form. Many changes in this case need to be done
If DevExpress team could not resolve this issue then I not have other way and need to convert all into classes based on UserControl
Thank you for the clarification, Andrii. This is reasonable. We'll see how to handle this issue on our side.
Hi Andrii,
We have not yet found the solution for this issue. However, there is a workaround that you can use if these forms are "short-lived" instances. I mean that you do not re-use one and the same instance multiple times in your application. In this situation, you can use this method to display the Form:
public void DisplayForm(Form form) { /* •Old Approach———————————————————————————————————————————————————————• | form.TopLevel = false; | | form.ShowInTaskbar = false; | | form.Dock = DockStyle.Fill; | | form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; | | formContainer.Controls.Add(form); | | form.Show(); | •———————————————————————————————————————————————————————————————————• */ this.formContainer.Controls.Clear(); foreach (Control ctl in form.Controls) ctl.Parent = this.formContainer; }
Is this solution acceptable in your case?
In this case form events as OnLoad(), OnClosing() etc not raise
Maybe in this case from my side I could set form parent to container.
form.Parent = this.formContainer;
And you from your side could check is exist parent. If exist then get it and find form of parent?
Hello Andrii,
Let me discuss your suggestion with our developers. I will get back to you soon.
Hello. Have you discuss this approach with developers already?
Hello Andrii,
Yes, I have. It turned out the that problem cannot be fixed easily. We still need additional time to research it further. Please accept our apologies for the inconvenience.
Hello Andrii,
Please accept my sincere apologies for the delayed response. Although your solution fixes the problem in case the Form containing the GridControl is not a top level form, it does not work perfectly in others cases. We are looking for a more general solution that can fix the problem completely. We need additional time to complete our research.