We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Exception using layout manager

Hi,

I started conversion to the latest v5.1.0.51 from v4.4.0.51. All projects compiled.
FlowLayout is used on some of the forms. Now it causes exception shown in attached file.

-E 05-22 16:55:47.053 1556:0011 WindowManager System.InvalidOperationException: Invoke or BeginInvoke cannot be called on a control until the window handle has been created.
at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
at System.Windows.Forms.Control.BeginInvoke(Delegate method, Object[] args)
at System.Windows.Forms.Control.BeginInvoke(Delegate method)
at Syncfusion.Windows.Forms.Tools.FlowLayout.LayoutContainer()
at Syncfusion.Windows.Forms.Tools.LayoutManager.OnLayoutEvent(Object sender, LayoutEventArgs e)
at System.Windows.Forms.Control.OnLayout(LayoutEventArgs levent)

The form is created but not displayed. Why FlowLayout needs handle of the form? Could you suggest a workaround?

Thank you,
Alex Feldman

4 Replies

AF Alex Feldman May 22, 2007 09:56 PM UTC

-E 05-22 16:55:47.053 1556:0011 WindowManager System.InvalidOperationException: Invoke or BeginInvoke cannot be called on a control until the window handle has been created.
at System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
at System.Windows.Forms.Control.BeginInvoke(Delegate method, Object[] args)
at System.Windows.Forms.Control.BeginInvoke(Delegate method)
at Syncfusion.Windows.Forms.Tools.FlowLayout.LayoutContainer()
at Syncfusion.Windows.Forms.Tools.LayoutManager.OnLayoutEvent(Object sender, LayoutEventArgs e)
at System.Windows.Forms.Control.OnLayout(LayoutEventArgs levent)
at System.Windows.Forms.ScrollableControl.OnLayout(LayoutEventArgs levent)
at System.Windows.Forms.Control.PerformLayout(LayoutEventArgs args)
at System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.PerformLayout(IArrangedElement affectedElement, String affectedProperty)
at System.Windows.Forms.Layout.LayoutTransaction.DoLayout(IArrangedElement elementToLayout, IArrangedElement elementCausingLayout, String property)
at System.Windows.Forms.Control.OnResize(EventArgs e)
at System.Windows.Forms.Panel.OnResize(EventArgs eventargs)
at System.Windows.Forms.Control.OnSizeChanged(EventArgs e)
at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight)
at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height)
at System.Windows.Forms.Control.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
at System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.SetBounds(Rectangle bounds, BoundsSpecified specified)
at System.Windows.Forms.Layout.DefaultLayout.xLayoutDockedControl(IArrangedElement element, Rectangle newElementBounds, Boolean measureOnly, Size& preferredSize, Rectangle& remainingBounds)
at System.Windows.Forms.Layout.DefaultLayout.LayoutDockedControls(IArrangedElement container, Boolean measureOnly)
at System.Windows.Forms.Layout.DefaultLayout.xLayout(IArrangedElement container, Boolean measureOnly, Size& preferredSize)
at System.Windows.Forms.Layout.DefaultLayout.LayoutCore(IArrangedElement container, LayoutEventArgs args)
at System.Windows.Forms.Layout.LayoutEngine.Layout(Object container, LayoutEventArgs layoutEventArgs)
at System.Windows.Forms.Control.OnLayout(LayoutEventArgs levent)
at System.Windows.Forms.ScrollableControl.OnLayout(LayoutEventArgs levent)
at System.Windows.Forms.Control.PerformLayout(LayoutEventArgs args)
at System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.PerformLayout(IArrangedElement affectedElement, String affectedProperty)
at System.Windows.Forms.Layout.LayoutTransaction.DoLayout(IArrangedElement elementToLayout, IArrangedElement elementCausingLayout, String property)
at System.Windows.Forms.Control.OnResize(EventArgs e)
at System.Windows.Forms.Panel.OnResize(EventArgs eventargs)
at System.Windows.Forms.Control.OnSizeChanged(EventArgs e)
at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight)
at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height)
at System.Windows.Forms.Control.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
at System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.SetBounds(Rectangle bounds, BoundsSpecified specified)
at System.Windows.Forms.Layout.DefaultLayout.xLayoutDockedControl(IArrangedElement element, Rectangle newElementBounds, Boolean measureOnly, Size& preferredSize, Rectangle& remainingBounds)
at System.Windows.Forms.Layout.DefaultLayout.LayoutDockedControls(IArrangedElement container, Boolean measureOnly)
at System.Windows.Forms.Layout.DefaultLayout.xLayout(IArrangedElement container, Boolean measureOnly, Size& preferredSize)
at System.Windows.Forms.Layout.DefaultLayout.LayoutCore(IArrangedElement container, LayoutEventArgs args)
at System.Windows.Forms.Layout.LayoutEngine.Layout(Object container, LayoutEventArgs layoutEventArgs)
at System.Windows.Forms.Control.OnLayout(LayoutEventArgs levent)
at System.Windows.Forms.ScrollableControl.OnLayout(LayoutEventArgs levent)
at System.Windows.Forms.Form.OnLayout(LayoutEventArgs levent)
at System.Windows.Forms.Control.PerformLayout(LayoutEventArgs args)
at System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.PerformLayout(IArrangedElement affectedElement, String affectedProperty)
at System.Windows.Forms.Layout.LayoutTransaction.DoLayout(IArrangedElement elementToLayout, IArrangedElement elementCausingLayout, String property)
at System.Windows.Forms.Control.OnResize(EventArgs e)
at System.Windows.Forms.Form.OnResize(EventArgs e)
at System.Windows.Forms.Control.OnSizeChanged(EventArgs e)
at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight)
at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height)
at System.Windows.Forms.Control.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
at System.Windows.Forms.Form.SetBoundsCore(Int32 x, Int32 y, Int32 width, Int32 height, BoundsSpecified specified)
at System.Windows.Forms.Control.SetBounds(Int32 x, Int32 y, Int32 width, Int32 height)
at Library.GUI.Desktop.Windows.WindowManager.PositionAndSizeWindow(IWindow aWindow) in C:\....\WindowManager.cs:line 2425
at Library.GUI.Desktop.Windows.WindowManager.ShowWindow(WindowInvocationData aWindowInvocationData, ApplicationContext anApplicationContext) in C:\...\WindowManager.cs:line 2024


GR Golda Rebecal Syncfusion Team May 23, 2007 06:16 AM UTC

Hi Alex,

I am afraid that I am not able to reproduce the issue of exception being thrown in a form having FlowLayout when upgraded from v4.4 to v5.1 with the attached sample.

Could you please modify the sample so that the issue could be reproduced? This will help us to resolve the issue soon.

We appreciate your interest in Syncfusion products.

http://websamples.syncfusion.com/samples/Tools.Windows/F61274/Main.htm

Best regards,
Golda


AF Alex Feldman May 23, 2007 01:35 PM UTC

Example is attached.

flow_example.zip


GR Golda Rebecal Syncfusion Team May 24, 2007 05:45 AM UTC

Hi Alex,

Thanks for the sample.

I am able to reproduce the issue of exception being thrown when the ContainerControl property of the FlowLayout has its Anchor set to Top,Left, Right, Bottom and the SetBounds method of the form that is having the FlowLayout is called.

Could you please create a Direct-Trac incident with the subject "Exception using layout manager- F61274" so that we could give more details regarding the fix?

Best regards,
Golda

Loader.
Live Chat Icon For mobile
Up arrow icon