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.
Related
In the image attached you can see that there are 5 panels inside a flowlayout panel. However, i can't scroll to the bottom of the flowlayout panel, to see the last added panel entirely.
Any ideea why?
I found a solution, it seems that i had the wrong size of the flowlayout panel, resizing fixed it!
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?
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.
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.
I wanted to scroll the background image that is displayed on the panel.
I looked at how to programmatically change the background image on form c# but did not get any idea.
Is it possible in C#?
You could create a control inside the panel that has the background image, and then the panel has a scroll bar which would actually move the entire control inside the panel, resulting in a moving background. I hope that makes sense.