mirror of
https://github.com/quasar/Quasar.git
synced 2026-10-23 00:38:41 +08:00
21 lines
673 B
C#
21 lines
673 B
C#
using System.Windows.Forms;
|
|
using xServer.Core.Helper;
|
|
using xServer.Core.Utilities;
|
|
|
|
namespace xServer.Core.Extensions
|
|
{
|
|
public static class ListViewExtensions
|
|
{
|
|
private const uint SET_COLUMN_WIDTH = 4126;
|
|
private const int AUTOSIZE_USEHEADER = -2;
|
|
|
|
public static void AutosizeColumns(this ListView targetListView)
|
|
{
|
|
if (PlatformHelper.RunningOnMono) return;
|
|
for (int lngColumn = 0; lngColumn <= (targetListView.Columns.Count - 1); lngColumn++)
|
|
{
|
|
NativeMethods.SendMessage(targetListView.Handle, SET_COLUMN_WIDTH, lngColumn, AUTOSIZE_USEHEADER);
|
|
}
|
|
}
|
|
}
|
|
} |