.NET Compact Platform - Extends Scroll Bars

Is there any way how to make scrollbar width in winforms for .net compact framework? I want to be application friendly, but the scrollbars are very narrow for people with no small fingers.

EDIT:

The problem is using the built-in scrollbars in components like ListView, DataGrid, etc.

Windows Mobile 6.0, .NET Compact Framework 3.5

Thanks.

+4
source share
4 answers

I did not check this because I do not have a device, but according to rumors, you can change the "Size for the registry" parameter:

[HKEY_LOCAL_MACHINE \ SYSTEM \ GWE]

cyHScr = 13 - The default height of the horizontal scrollbar

cxVScr = 13 - Default vertical scrollbar width

Yours faithfully

Thomas

+2
source

Here is my example:

  • .net (and the cf version) gives you access to a collection of datagrid / listbox controls ... so you can go to control, that is, to the scroll bar through the control array. For example, mydatagrid.Contorls[0] will be the horizontal scrollbar. This can be done byname, maybe I'll post a more detailed solution later.
  • Once you have achieved the right control, it's just a matter of updating the Height property on the scroll bar, right? ... wrong! Remember that the scroll bar is an element in a datagrid / listbox ... therefore its initial location (painting position) is set at a point that will allow the element to see the height value that it was initialized ... therefore your code will deal with the permutation of the location scroll bars in the source rectangle.

     myDataGrid.Controls[0].Height = myDataGrid.Controls[0].Height + 60; myDataGrid.Controls[0].Location = new Point(myDataGrid.Controls[0].Location.X, myDataGrid.Controls[0].Location.Y - 60); 

Finally, you need to consider: When you play with the size of the scroll bar, you need to remember that other parts of the element depend on the scroll bar, for example, if the scroll bar covers some lines in the grid, they will not be available ...

+1
source

VB Version:

 'Increase size of the Vertical scrollbar of your DataGrid' For Each vBar As VScrollBar In yourDG.Controls.OfType(Of VScrollBar)() vBar.Width = 25 Next 'Increase size of the Horizontal scrollbar of your DataGrid' For Each hBar As HScrollBar In yourDG.Controls.OfType(Of HScrollBar)() hBar.Height = 25 Next 

All thanks go to Yahoo Serious.

+1
source

You can use reflection. Inspired by this link , my code will look something like this. (This may be too careful, but I'm not sure how it would be with reflection. For example, VScrollBar was not found for the TextBox in this form.)

 using System.Reflection; //... public static void SetVerticalScrollbarWidth(Control c, int w) { try { var lGridVerticScrollBar = GetNonPublicFieldByReflection<VScrollBar>(c, "m_sbVert"); lGridVerticScrollBar.Width = w; } catch { // fail soft } } public DataGridForm() { SetVerticalScrollbarWidth(dataGrid, 30); } public static T GetNonPublicFieldByReflection<T>(object o, string name) { if (o != null) { Type lType = o.GetType(); if (lType != null) { var lFieldInfo = lType.GetField(name, BindingFlags.NonPublic | BindingFlags.GetField | BindingFlags.Instance); if (lFieldInfo != null) { var lFieldValue = lFieldInfo.GetValue(o); if (lFieldValue != null) { return (T)lFieldValue; } } } } throw new InvalidCastException("Error in GetNonPublicFieldByReflection for " + o.ToString() ); } 
0
source

Source: https://habr.com/ru/post/1285894/


All Articles