Skip to Content
avatar image
Former Member

Other forms stick on a freezed form

Hello, on a document form I'm doing oForm.Freeze(true) and oForm.Freeze(false) and between them I open an other form (WinForms but it makes no difference) for asking user input. If user moves such form or other B1 forms over the freezed form, their layout remain stuck on the freezed form layout, causing a bad user experience.

How can I avoid this? Is there a way to keep the freezed form layout "refreshed", simply preserving its appearence?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Mar 09 at 01:28 PM

    Maybe you could use a modal form instead.

    Freeze method is used when you want to update some stuff in the freezed form without let the user see the actions and without flickering

    https://answers.sap.com/questions/452411/load-modal-form-with-loadbatchactions.html

    Using a windows form

    	[DllImport("user32.dll")]
            private static extern IntPtr GetForegroundWindow(); //THIS FUNCTION CAN STAY IN ANY PLACE YOU FIND APPROPRIATE
    
    //THIS YOU CAN PUT IN YOUR BUTTON WHICH CALLS YOUR WINDOWS FORM
    				WindowWrapper oWindow = new WindowWrapper(ptr);
    				
    				FormTest form = new FormTest();
    				Thread tr = new Thread(()=> form.ShowDialog(oWindow));
    
    
    				tr.SetApartmentState(ApartmentState.STA);
    				tr.Start();
    
    
    	public class WindowWrapper : System.Windows.Forms.IWin32Window
    	{
    		private IntPtr _hwnd;
    
    
    		// Property
    		public virtual IntPtr Handle
    		{
    			get { return _hwnd; }
    		}
    
    
    		// Constructor
    		public WindowWrapper(IntPtr handle)
    		{
    			_hwnd = handle;
    		}
    	}
    
    
    Add comment
    10|10000 characters needed characters exceeded