Static position within Flow layout panel - c#

I've been trying, for hours, using different implementations with background images and Paint handlers, to set a fade over a list of labels in a FlowLayoutPanel.
The list is horizontal (wrap=false), and automatically scrolls to the end (the last item is continually scrolled into view), which is why I wish to apply the fade at the start (so you can see that there are more items out of view).
I believe if I can fix a label at the start, having it hover over the other labels in the Panel, I can then draw the background over.
I tried adding the label over the Panel itself, but it is not transparent over the panel, just a white box...
Is this possible?

Related

Hiding a panel should force controls below to move up and resize the form

OK, this is driving me a bit nuts at this point. Time to ask the crowd:
I have a form that consists of: two vertical "halves" created by a SplitContainer. Inside the bottom "half" / SplitContainer panel... I have:
A set of fields/controls for the user to fill out, contained within a panel.
Below that, a panel containing buttons for "submit", "cancel"...and one that's "show/hide". This "show/hide" is intended to show/hide the panel I just described in point 1 above.
What I want to happen is: when the user clicks to "hide" the panel of controls, not only do those controls vanish, but also:
The panel containing the submit, cancel and show/hide buttons moves up (so that we don't have this big blank space where the now-hidden panel once was).
The form resizes itself vertically so as to make up for the now-hidden panel and the fact that we've moved the bottom controls upwards.
I have no problem getting the panel of controls/fields to show/hide. But I can't seem to figure out how to accomplish the other two tasks. I've tried various combinations of AutoSize, AutoSizeMode, and Dock options.
Any suggestions?
If you put all your controls into a FlowLayoutPanel where the children are arranged vertically, then hiding some controls should cause the "lower" controls to move up the page.
You might still need to write some code to resize the form itself once the optional content has been hidden or before it's shown.

Adding a vertical scrollbar to a panel if drawn area is too large

I'm using WinForms and C#.
The application I am developing draws rows of rectangles (using g.DrawRectangle()) inside of a panel. The panel can hold 6 rectangles in width (I don't want to have horizontal scrolling). I control this within the application by counting the rectangles in the row, and then adding to the y value after the sixth rectangle.
Vertically, I want to be able to add infinite rectangles and scroll down to see them. Right now, the rectangles are being added, but the Panel doesn't scroll (they are just added off screen).
Is there a way to add a vertical scrollbar? I have tried setting the AutoScroll property to true, but that doesn't do anything.
The problem is that you are using graphics to draw on the panel. These are not controls, so they don't cause the panel to grow. you should create two panels - PanelA contains PanelB. PanelA has AutoScroll=true, but you draw on PanelB. As you draw, you also set the height of PanelB, so that when it gets bigger than PanelA, PanelA gets a scroll bar.

Scrollable and drawing panel

I have a big picture and I want the user to load it in a scrollable panel, in other words, the user should load the picture as background of the panel. When loading, the scroll bars should appear. I want to draw in that panel so I have to call myPanel.Invalidate many times. I think if I call myPanel.Invalidate, the panel will be drown from the top so I can't see the bottom of the panel when I want to draw.
May I have a scrollable and drawing panel simultaneously? Is there a solution?
Thanks in advance.

Which WPF Layout and Controls Should I Use for a Storyboard Effect

I want to create a layout that has small panels at the top and bottom and then a main panel in the center that fills the remainder of the window. The main window should have the functionality of a tab panel but instead of simple tabs I want the tab pages to slide on and off the screen. It will be like one large storyboard that slides back and forth and only displays one scene at a time.
So lets assume there are 4 tab pages. Initially the first page will be visible, the 2nd page will be directly off the screen to the right, the 3rd page will be 2 pages off the screen to the right and the 4th page will be 3 pages off the screen to the right. When the user clicks to see the 3rd tab page the layout will slide left 2 pages. Then if the user clicks to see page 1 again, the page will slide back right 2 pages.
The window needs to be resizeable, so I can't use fixed sizes and offset.
Do I just need to use a StackPanel and programmatically set width, height, and position or is there something built-in that I can use?
Hrrrm the first idea that comes to mind is use a ScrollViewer and hide the ScrollBars.
You could then display all your items in a StackPanel in the ScrollViewer, and when you want to scroll an item into view, simply animate the ScrollViewer's position so it smoothly scrolls to the specified item.

C# List of Panels

I would like to create panels with detailed information regarding an item (including a thumbnail image on the left hand side) and then add these to a scrollable list. Much like how iTunes on the iPhone displays the lists of applications available.
I have done some searching but have thus far been unable to find any assistance.
Does anyone have any ideas or links to samples they would like to share with me.
Thanks in advance,
Rob
In sum, the following creates a series of panels within a container that scroll in and out of view using a vertical scroll bar.
You did not list ASP.NET in your tags, so I assume this is Windows form-based, not web based. I'll get you started:
Create a panel called GrandChildPanel. Inside it, put an image box on the left side and labels with the information you want to display next to the image. This panel will be duplicated for every item (i.e., iTunes song).
Put that panel inside another, equal-width, equal-height panel called ChildPanel.
Create another panel called ParentPanel and set its width to the size of the other panels plus enough room for a vertical scroll bar. Set the height equal to however tall you want the scrollable area to be.
Put ChildPanel in the top-right corner of ParentPanel and add a vertical scroll bar to the far right edge of ParentPanel. Set the scroll bar's height to takeup the entire height of ParentPanel.
You probably want to add a border to ParentPanel to show its boundaries.
You also probably want to add a 1 or 2 pixel line across the bottom of your GrandChildPanel to show where the panel ends.
That's the setup. Here are the requirements for your code: Each time you 'add an item to the list' (e.g., every song in your iTunes list), you do the following:
Clone the GrandChildPanel.
Assign the clone to be a child of the ChildPanel.
Set the clone's Top to be equal to the previous clone's Top plus its Height.
Set ChildPanel's Height equal to any given GrandChildPanel's height multiplied by the number of clones.
Set the scroll bar's maximum value to equal ChildPanel's height.
Now, all you have to do to make this scrollable is perform the following on the scrolling or changing events of the vertical scroll bar: Set ChildPanel's Top to be equal to the verticle scroll bar's value ("position") multiplied by -1.

Categories

Resources