I create a window with grid Including 2 stackpanel with controls.
I want to allow the user to change the layout in real time.
for example to switch between the 2 stackpanels that the lower will be in the top And vice versa.
I have also window with tabs and I want to allow the user to take one tab and drag it that it will be like a floating window.
thank you!
Create 2 rows in the Grid - one for each StackPanel. Then at runtime call this code to reorder.
Grid.SetRow(myStack, 1);
As for the tabs, try http://dragablz.net/
Related
I have been working with wxPython for quite a while now. I have a pretty good handle on most objects, and I've been able to create panel layouts without issue for the most part.
What I'm trying to do here is to display two lists (combo boxes.) One represents the complete list of possible options (on the left) that the user may select and add to the list on the right. The functionality works just fine, but the objects themselves visually become obscured by other panels contained within the same tab of a wxNotebook object (see red rectangle on attached image.)
The top panel is a composite of three panels. The first contains a combo box and some spacers. The second (middle) contains the buttons that allow the user to add/remove items. The third, like the first, is a combo box and some spacers. The middle panel scales fine, but I cannot adjust the height of the combo boxes.
I want the combo boxes to be the wx.CB_SIMPLE layout so that all options are displayed. Ideally, if the number of options exceeds the panel height, I would see a vertical scroll bar.
What would be the easiest way to accomplish this without losing the combo boxes behind other panels?
I don't see a need to have 3 panels nested inside of your notebook page. Instead I would create one panel with nested sizers. You can create one horizontal BoxSizer to hold all the widgets. Then inside of that, you can add the left combobox to the sizer. Next create a vertical sizer that you can put your buttons into (add, remove, clear).
Add that vertical sizer to your horizontal sizer. Now create your right combobox and add it to the horizontal sizer. Now you have the same setup or close to it and you won't have panels crossing over each other.
I have to design a calculator, but am working on the design first. The = button doesn't go into the space between the other buttons on the screen where I would like to place it. Here is a picture of what I have so far:
Uploaded with imageshack.us http://imageshack.us/a/img843/7687/unbenannt22z.jpg
I used StackPanels to create my Main Panel. How can I go about fixing this?
if you arrange your buttons in a Grid rather than a collection of StackPanels, then you'd be able to put the Equals button in the next to last row of the grid, and set its Grid.RowSpan to 2 so that it would work out as you intended.
I want to anchor below datagridviews to top, left, right & down in a way that they don't over lap when the size of form is increased or decreased. Dock and Anchor both don't seem to provide any solution for this.
You probably need to have a TableLayoutPanel handle that. Three columns, middle column is fixed (Absolute), the outside columns would be based on percentage (50% each).
The DataGridView controls would then be dock-filled into each side column.
Or just handle the layout yourself in the form's Resize event.
I have a container whose size can change.
I will by dynamically creating instances of a user control and adding them to that container.
the size of the user control is fixed. what I want to do is, fit the most number of user controls in the container.
I think a good approach is to add the children horizontally until there is no more space to add another and then start another row.
Say, each row fits 3 children for a given width of the container. if it is expanded enough, it should automatically fit 4 children in a row.
Is there a container control (StackPanel Grid etc.) that I can use to host these user controls. What properties need to be changed.
On resizing the container, it should relocate the children so that the maximum children ae shown. Scrolling is okay as long as max are shown at any given time.
Is there a container that does this automatically? or should I manually create rows or panels or something and add n children to each - i.e., do it manually?
I think what you need is a WrapPanel.
There's a Panels Overview on the MSDN with a lot more information and links to specific types of Panel including the WrapPanel:
WrapPanel positions child elements in sequential position from left to right, breaking content to the next line at the edge of the containing box. Subsequent ordering happens sequentially from top to bottom or right to left, depending on the value of the Orientation property.
I think a good approach is to add the children horizontally until there is no more space to add another and then start another row.
This is exactly what a WrapPanel does.
I have a dialog with column down the right side filled with buttons. The dialog is built with Windows Forms. I have a mockup at the following link:original dialog
(I would have included it but apparently i'm not allowed to use image tags)
I would like for the buttons in the right column to resize themselves to fill the remaining vertical space when the dialog resizes. It doesn't particularly matter to me whether or not buttons simply increase in size or whether the buttons remain the same size while the gaps between them increase. I'm simply want the buttons to go from the top to the bottom. (I have a mockup for this as well but apparenlty i can only include one link)
I've tried hosting the buttons in a FlowLayoutPanel but they do not increase as the dialog stretches, I only get whitespace at the bottom after I run out of buttons. I also tried a TableLayoutPanel and had the same result but I may have misused it. Does anyone have any ideas how I could accomplish this?
Thanks in advance,
Jeremy
To get you started. Use the TableLayoutPanel, set its Anchor property to top, bottom, left, and right. Set the rows and columns to percentages as needed. I suggest each control have it own cell. Note that each control in a "cell" can have its Dock and Anchor property set as needed.
You can do this with a TableLayoutPanel. Create a column for the buttons, with each button having it's own row / cell in the column. Set each row to be an even percentage for height (if there are 10 buttons, each row would be 10%), and dock the TableLayoutPanel to the right side of the screen. Then, put the buttons into their rows and set them to full docking. Then, when the dialog expands, the TableLayoutPanel will expand to fill the entire right side of the screen, each row will adjust proportionally, and each button would expand to fit the new row size.
You may have to adjust this a bit to fit your needs, especially in how it relates to the other content in the window.