mirror of
https://github.com/colhountech/DarkUI.Net5.git
synced 2025-07-02 07:09:27 +03:00
ControlScrollFilter can be added to the application's message filter list to re-route all mousewheel events to the control the user is current hovering over with their cursor.
55 lines
1.8 KiB
C#
55 lines
1.8 KiB
C#
using DarkUI;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Example
|
|
{
|
|
public partial class MainForm : DarkForm
|
|
{
|
|
public MainForm()
|
|
{
|
|
InitializeComponent();
|
|
|
|
// Add the control scroll message filter to re-route all mousewheel events
|
|
// to the control the user is currently hovering over with their cursor.
|
|
Application.AddMessageFilter(new ControlScrollFilter());
|
|
|
|
// Build dummy list data
|
|
for (var i = 0; i < 100; i++)
|
|
{
|
|
var item = new DarkListItem(string.Format("List item #{0}", i));
|
|
darkListView1.Items.Add(item);
|
|
}
|
|
|
|
// Build dummy nodes
|
|
var childCount = 0;
|
|
for (var i = 0; i < 20; i++)
|
|
{
|
|
var node = new DarkTreeNode(string.Format("Root node #{0}", i));
|
|
node.ExpandedIcon = Icons.folder_open;
|
|
node.Icon = Icons.folder_closed;
|
|
|
|
for (var x = 0; x < 10; x++)
|
|
{
|
|
var childNode = new DarkTreeNode(string.Format("Child node #{0}", childCount));
|
|
childNode.Icon = Icons.files;
|
|
childCount++;
|
|
node.Nodes.Add(childNode);
|
|
}
|
|
|
|
darkTreeView1.Nodes.Add(node);
|
|
}
|
|
|
|
// Hook dialog button events
|
|
btnDialog.Click += delegate
|
|
{
|
|
DarkMessageBox.ShowError("This is an error", "Dark UI - Example");
|
|
};
|
|
|
|
btnMessageBox.Click += delegate
|
|
{
|
|
DarkMessageBox.ShowInformation("This is some information, except it is much bigger, so there we go. I wonder how this is going to go. I hope it resizes properly. It probably will.", "Dark UI - Example");
|
|
};
|
|
}
|
|
}
|
|
}
|