I have problem with design inherited control. Please take a look at the attachment:
flowLayoutPanel1 is outside of designer of InheritedDataForm and Anchor is set to Left, Bottom, Right. But in runtime it comeback.
Thanks for your help,
The issue is that the designer in Wisej fixes the error in the code but if you don’t save it you will get the error at runtime.
The code from VWG is wrong, and it may have worked because of a bug in VWG layout.
Anchoring anchors a control to the parent’s sides. Looking at the code you have coming from VWG, you can see that:
This shows identical in the designer and at runtime. Anchoring the datagrid t,l,r,b means that the proportional distance on the 4 sides is maintained: when the container is resized, the distance of the datagrid’s 4 sides to the container is preserved.
Since the grid us 352 in height and the parent splitContainer.Panel2 is 410 in height, the bottom of the grid will always be 410-352 = 58 pixels from the bottom of the panel.
The wrong code is in InheritedDataForm:
Looks like the designer code in InheritedDataForm was changed by hand or VWG generated the wrong dimensions.
Which means that in InheritedDataForm the size of the grid and the bottom of the grid are much smaller than the parent and the bottom grid will be 883-635=248 pixels from the bottom of the container.
The layout depends on the state of the layout engine and the corresponding calls to SuspendLayout() and ResumeLayout() and the designer is applying them in the design order to fix the layout, but you need to save it or the wrong code will run at runtime.
The only issue I see is that the designer didn’t mark the file as modified when it should. See screenshot 2, the designer changed the grid to be 1249 x 1021 to make it work but if it’s not saved the original proportions will be used at runtime.
How did you create InheritedDataForm? It looks like the sizes (and locations) are all off.
I just tried by:
This gave me a control that was identical to BaseDataForm (superclass), with flowLayoutPanel1 in the appropriate place.
The reason InheritedDataForm probably looks okay in your browser is because it’s larger than the Designer and the anchoring keeps it at the bottom of your screen.
I think if you try creating a new inherited control with this method it will solve your issue!
Let me know!
Please login first to submit.