Hello I've got a loop that adds some drop down items to a Tool Strip:
usersToolStripMenuItem.DropDownItems.Add(ss);
However this list is going to be long. Is there any way to confine the size of the drop down box (which currently takes up the height of the screen)?
On another note, I've noticed it doesn't support scrolling, is that doable?
No possible.
Hans Passant:
It is already confined, it ran out of screen. Click the little triangle at the bottom to scroll. Usability demands you start using sub-menus.
Related
I have a pretty vague description of something I'd like to do, but not entirely sure if it's possible. Well, more accurately not entirely sure of the best way to go about it.
Say I have a single ScrollView and my device is in landscape mode. I have 15 Label objects each on their own line so most of them are off the screen. The user can scroll up and down as you would expect. That's all fine.
For talking sake let's assume that we can only fit 5 Label objects on the screen at any one time. How would I go about ensuring that the middle item of text (the third) on screen at all times has a larger font size? I.e. if the user continues to scroll down the fourth item would become the new centre item and thus be enlarged. Even better, the first and fifth items would be even smaller.
Does that make any sense?
It's kind of like on an iPhone when you're selecting a Month, it's a spinner effect where the middle item (the one that is selected) is always highlighted.
This isn't something you're going to get out of the box. You can either create a custom control and relative custom renderer and build it all out manually, or you could tap into the ScrollView.Scrolled event, then look at the ScrollView.ScrollY value, and then iterate your Labels manually adjusting the FontSize property based on some calculations of how close they are to the scroll position.
I'm developing a windows form application using c#. How can I set a space between items in a checked list box?
You can't, increasing the font size is all you got. Not exactly a control that's suitable for a touch screen. You can re-implement it with ListBox.DrawMode and ControlPaint.DrawCheckBox().
The better selection here is a ListView with View = Tile, easy to hit with your thumb when you make the tile big enough. You can't use ListView.CheckBoxes anymore, using an icon is a good choice. Also automatically takes care of the user only selecting one item.
Looks like you could go with a ListView (which always always always ist the better choice anyway) and a (dummy) imagelist. See
here and here.
Just tried it and it's really easy: Add an imagelist to your form; set its imagesize width to something small and its height to your liking and apply it as the listview's stateimagelist. No need for any actual images.
No need to go for tiles and you could add prices in a 2nd column, even with a different font.. ListView rules ;-)
Let us see the final result! Yumm!!
Under the Behavior Properties, look for ColumnWidth
Imagine a panel with 4 PictureBox aligned in one line and then you decrease the size of the window and hence the panel size (it's anchored). Then, when there is no space for 4 PictureBox in one line, the last one goes down to the second line, becoming three PB in the superior line and the forth PB in the second.
If you continue decreasing the window size, the boxes will go down until remain a unique column of PictureBox.
The only idea that came mind was use "if" conditions... Is there an easier way to do that? I thought it could be made by some property of the panel or PB, but I'm wrong I suppose...
Summarizing: How to make the elements inside a panel be adjusted to fit in the panel when you change your size?!
Here it goes a image to illustrate the situation:
#Idle_Mind, Yes, Windows Forms Application. I've forgotten the FlowLayoutPanel, but I don't like it very much, if someone knows some way more easy, feel free to comment. For now, I will use the FLP. Thank you n_n
Just passing to mark the question as answered (on a comment in my question). I didn't use to know controls as FlowLayoutPanel or WrapPanel, etc. Thanks Idle_Mind.
I used many expander in the WPF application.. but I face some troubles:
When I try to put them below each others, the upper one expands automatically and makes it difficult to put the net one below it.. So I should separate the upper one in any place until I put the lower one then move back the upper one again. Can I keep expander unexpanded to make it easy to put any controls below it?
When I press ctrl+f5 and expand one of them, I see it has a transparent background and makes interruption with the lower ones - how can I avoid that?
I used scroll bar inside expander, but it doesn't work when i press ctrl+f5. I have an inactive scroll bar. How can I make link between scroll bar and expander to be able to move items inside expander up and down?
This is a picture to explain what I mean.
have a look at ths tutorial, it covers stuff like this, The Expander can be a tricky control to deal with sometimes, but once you understand the the expanders layout it becomes a bit easier.
http://blogs.msdn.com/b/wpfsldesigner/archive/2010/02/03/taming-the-wpf-expander-control.aspx
I'm new to C# and I've been working on a small project to get the feel with Visual Studio 2008. I'm designing the GUI in C#, and I have a TabControl with three GroupBoxes. These three GroupBoxes are anchored to the left and right of the screen and work perfectly when resized horizontally.
I would like these three boxes to take up 33% of the height of the screen, and gracefully resize. I've tried messing around with anchoring, but I can't seem to find the answer. I've also been searching for something similar, but unfortunately, searching for positioning containers yields all CSS and HTML stuff.
This seems like a pretty common thing to do, but I can't seem to find an easy to way to do it. If someone could point me in the right direction, I'd greatly appreciate it.
Thanks!
Try out the TableLayoutPanel. I believe it does exactly what you want. It allows you to define columns and rows within its area, specifying their width (for columns) and height (for rows) in percentages or pixels. You can then drop a group box into each cell and set its Dock property to Fill, and it will nicely resize along with the cell when the TableLayoutPanel resizes (which can be easily achieved by using docking or anchoring).
This is really a shot in the dark but maybe you could try using split-panels ?
Edit: I've just checked in Visual Studio and I think the TableLayoutPanel might do what you want.
Edit2: dang, beaten to the punch :)
Handle the form's Resize event: Add code to compute the new size/position of the controls in there. Beware to interferences with the controls' Anchor property. You may have to Anchor to None and compute left and right position yourself as well.
Since you're learning, I guess you prefer not to receive a full solution but rather a direction. No code from me then ;-)