I'm wondering what would go into creating my own layout manager. Neither the flow layout manager nor the gridbag layout manager seems to do exactly what I want, although the flow layout manager might be able to work with some customization.
Basically, I want to be able to add controls with a default gap between, but the gap should be overridable, perhaps with something akin to the inset for the gridbag. I also want to be able to control where a new row would occur, also conceptually doable with a constraint, I would guess. The gap between rows should also have a default size that is overridable.
I am unsure how to start on this and would welcome any help. Could this be done with subclassing the flow layout and creating constraint objects to handle the customized gaps and forced wrap, or would it be better to start from the base class? Are there any tutorials/samples that would help?
Thank you,
Jon Scharff
Hi Jon,
The following topic and sample uses the GridBagLayoutPanel to position controls and also manipulate the size of virtual columns and rows.Please let me know if this helps.
http://es.infragistics.com/products/windows-forms/sample/grid-bag-layout-panel/gridbaglayoutmanager-foundation
I have also attached a sample that i created using the GridBagLayoutPanel in which i have changed the insets of the control to reposition it
You will also be able to request this as a new Product idea at http://ideas.infragistics.com> and Selecting the Product - Winforms. You will need to create a new login if you don't have an account.
Thanks
Alka
Alka,
Thank you for your response. The gridbag layout, as its name implies, assumes the controls will be laid out in a grid pattern, with controls roughly aligned by column as well as by row. I do not want to assume that the controls will be aligned by column, which is why I believe that the flow layout is closer to what I want.
I am not necessarily interested in a new product. As the LayoutManagerBase is described as a "Base class for others to implement their own layout managers," I was under the assumption that creating one's own custom layout was the intent. Thus, I was looking for more information on how to implement one on my own.
Thank you again,
Please let me know if there is anything else that i can help you with.
The LayoutManagerBase class was meant for common code for the Layout managers that we provide. It isn't expected to be used to create a custom layout Manager. Please let me know if you have any further questions.