-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScrollListView.cs
More file actions
28 lines (24 loc) · 968 Bytes
/
ScrollListView.cs
File metadata and controls
28 lines (24 loc) · 968 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System;
using System.Windows.Forms;
//Neprovádět bezdůvodné zásahy do logiky, hrozí rozbití aplikace
namespace Pokladna
{
public class ListViewWithScrollBar : ListView
{
protected override void OnHandleCreated(EventArgs e)
{
base.OnHandleCreated(e);
// Přidání stylů scrollbarů
int style = NativeFunctions.GetWindowLong(this.Handle, NativeFunctions.GWL_STYLE);
NativeFunctions.SetWindowLong(this.Handle, NativeFunctions.GWL_STYLE, style | NativeFunctions.WS_VSCROLL);
// Vynucení zobrazení scrollbar
NativeFunctions.ShowScrollBar(this.Handle, NativeFunctions.SB_VERT, true);
}
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
// Zajisti, že scrollbar zůstane viditelný
NativeFunctions.ShowScrollBar(this.Handle, NativeFunctions.SB_VERT, true);
}
}
}