dotnet/winforms

Discussion/proposal: add more LVCOLUMN ComCtl 6.0 features

Open

#2,627 opened on 2020年1月4日

GitHub で見る
 (5 comments) (3 reactions) (2 assignees)C# (922 forks)batch import
api-approvedarea-controls-ListViewhelp wantedtenet-compatibility-OS

Repository metrics

Stars
 (4,100 stars)
PR merge metrics
 (平均マージ 14d 22h) (30d で 56 merged PRs)

説明

In Windows Vista, more LVCOLUMN features were added: see https://docs.microsoft.com/en-us/windows/win32/api/commctrl/ns-commctrl-lvcolumnw

Missing Features

Minimum Width

  • Can set the LVCF_MINWIDTH flag on mask and set the cxMin value

Would add the following API on ColumnHeader

public class ColumnHeader
{
    ...
    public int MinimumWidth { get; set; } = 0;
    ...
}

E.g. Notice that when resizing the column its minimum width is 100 pixels Screen Recording 2020-01-04 at 08 25 pm

Fixed Width Columns

  • Can set the LVCF_FMT flag on mask an set the LVCFMT_FIXED_WIDTH flag on fmt

Would add the following API on ColumnHeader

public class ColumnHeader
{
    ...
    public bool FixedWidth { get; set; } = false;
    ...
}

E.g. Notice that the column can't be resized umn

Split Button Columns

  • Can set the LVCF_FMT flag on mask an set the LVCFMT_SPLITBUTTON flag on fmt

Would add the following API on ListView and ColumnHeader

public class ColumnDropDownClickEventArgs : ColumnClickEventArgs
{
    public ColumnDropDownClickEventArgs(int column, Point screenLocation);
    public Point ScreenLocation { get; set; }
}
public class ListView
{
    ...
    public event ColumnDropDownClickedEventHandler ColumnDropDownClicked { add; remove; }
    protected void OnColumnDropDownClicked(ColumnDropDownClickEventArgs e);
    ...
}
public class ColumnHeader
{
    ...
    public bool SplitButton { get; set; } = false;
    ...
}

E.g. Screen Recording 2020-01-04 at 09 15 pm

Discussion

  • Should we consolidate things like Split Button and Fixed width into a flags enum and add this as a property (e.g. Style) on ColumnHeader
[Flags]
public enum ColumnHeaderStyles
{
    None,
    FixedWidth = X,
    SplitButton = Y
}

/cc @weltkante

コントリビューターガイド