.NET Compact framework - make scrollbars wider

前端 未结 4 1088
甜味超标
甜味超标 2021-01-13 18:51

Is there some way, how to make scrollbar wider in winforms for .net compact framework? I want to be application finger-friendly, but the scrollbars are very narrow for peopl

4条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-13 19:07

    Here is my take on this:

    1. .net (and the cf version) gives you access to the control collection of the datagrid/listbox... so you can get to the control i.e. the scrollbar via the control array. For instance mydatagrid.Contorls[0] would be the horizontal scrollbar. This can be done byname maybe I'll post a more elaborate solution later.
    2. Once you've reached the correct control, it is simply a matter of updating the Height property of the scrollbar, right?...wrong!! Remember the scrollbar is an element within the datagrid/listbox...therefore it's original location (painting position) is set at a point which would enable the element to be seen at the height value it was initialized at... so your code will have to deal with the repositioning of the scrollbar location within the original 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 things to consider: When you play around with the scrollbar size, you need to remember other parts of the element depend on the scrollbar, for instance if the scrollbar ends up hiding some rows on the grid, they won't be reachable...

提交回复
热议问题