Attaching a VScrollbar to a control that already supports scrollbars - c#

I have an application written for a touchscreen. It mainly consists of a listview and a DataGridview. the default control scrollbars are too narrow for gloved hands, so i would like to increase the width of the scroll bars in those two controls.
I don't see any way to do it in the designer, so I started working with the VScrollBar control; however, this does not replace the default scrollbar for those controls, rendering it ineffective.
So, my question is twofold:
Can I override the width of the default scrollbar?
If not, can I somehow make the new VScrollbar the default for that control?

Related

AutoScroll event in WIndows Forms

I have a windows form with two controls, one mail control (Dock = Fill) and a property control (Dock = Right). The property control is set to AutoScroll. It has some expandable panels and if the user expands too many panels the height of the control is larger than the window height and I set the AutoScroll property in order to automatically display scrollbars in this case - this does work. However the scrollbar is plotted over the property controls. The scrollbars of course needs some place but I would like the property window to grow in width as long as the scroll bar is shown (and hence reduce the size of the main control a bit) so that the scrollbar is on the right side of the property control which is completely shown.
Can you give me a hint? Do I need to change some properties of the controls? Or is there an Event "ScrollBarsShown" or something which I could catch and manually extend the width of the property control?
Thank you very much!
Put these controls in a TableLayoutPanel. The arrangement should be two columns, one row. Column0 would be set to 100%, while Column1 would be AutoSize. The Row could be either.
Then just dock fill the TableLayoutPanel in your form.

Custom scrolling in Winforms c#

I am developing an application that will use touch screens to navigate for use in a warehouse environment.
There is a need to present a list to the users and because this list could be quite long, the user will at some point need to scroll down the list.
As you all know the system scroll bars for panels and textboxes etc is quite small and I would like to know if I can either resize the controls that make up the scroll bar (the little arrows at the top and bottom, and the place holder bar in the scroll bar itself), or if I can create a couple of buttons that can scroll up and down my control for me?
Thanks,
Karl
Answer pulled from this post.
Check this out:
Winforms - Adjust width of vertical scrollbar on CheckedListBox
Worth mentioning too:
.NET Compact framework - make scrollbars wider
More of the same, but this time with a better solution through the use of the scrollbar control:
Change the width of a scrollbar
Another one in which the guy teaches how to create your own scrollbar control (interesting):
Set the Scrollbar width of a DataGridView
The last one (worth trying):
Is there a way to get the scrollbar height and width for a ListView control
You can add your own scroll buttons and programatically scroll like so:
myPanel.VerticalScroll.Value++;

Auto resizing controls on full screen in windows forms

I want to auto resize my windows form controls on fullscreen. I use tableLayoutPanel and anchoring.
But it's not pleasing to the eyes. I used flowLayoutPanel, but it doesn't work. I have around 35 controlrs on one single form, including labels, textboxes, comboboxex, radiobuttons, datagridview and checkbox.
Is there any other method by which I can resize the controls? And if not, can anybody suggest me a way to use the tableLayoutPanel and anchoring more effectively?
It seems to me that what you want to use is the Dock property of all controls as well as using TableLayoutPanel. From the images you provided it looks like you want want the top half of the form to be a TableLayoutPanel, and to set the Dock Property to DockStyles.Fill. Then set the bottom ListView to DockStyles.Bottom.
You can either dock each control in a TableLayoutPanel cell or set the Anchor properties to AnchorStyles.None to make the controls automatically be centered in the cells.

Resizing SplitContainer makes controls invisible

Why does the WinForms SplitContainer hide all the Buttons in a Panel (in the left Splitter) when I resize on of its panels? Do I have to write specific code for invalidation of the Panel?
Yes, there's a solution. You can use Anchor property of SplitContainer in winforms. Using which you can set the value of the anchor as you required.
EDIT:
Anchor property will make your control fixed to the winforms design. Even if you resize the control, all the controls that the major control is holding will also resize according to it.

Auto scrolling control (WinAPI)?

In C# (.Net) you can create a panel and set autoscroll to true. you can then add controls into it, including beyond it's size, then it will scroll.
I was wondering if when using the real WinAPI in c++ (not .net) how one could acheive the same result.
Must I keep track of the controls inside and move them all when I scroll or is there an easier way like in C#.
Thanks
For an edit control (textbox), you can supply ES_AUTOVSCROLL when creating it via CreateWindow or CreateWindowEx. For adding a scrollbar for multiple controls in a window, I believe you have to do it manually. Write a function to sum the vertical height of all the child controls + spacing between them and if it's smaller than the window, add a vertical scroll bar, if it's larger, remove the vertical scroll bar (if it exists). Be sure to call this after adding/removing child controls and on window resize.

Categories