diff --git a/lcl/comctrls.pp b/lcl/comctrls.pp index 616d620b80..4e5ad24963 100644 --- a/lcl/comctrls.pp +++ b/lcl/comctrls.pp @@ -1002,7 +1002,6 @@ type function IntfCustomDraw(ATarget: TCustomDrawTarget; AStage: TCustomDrawStage; AItem, ASubItem: Integer; AState: TCustomDrawState; const ARect: PRect): TCustomDrawResult; protected property AllocBy: Integer read FAllocBy write SetAllocBy default 0; - property BorderStyle default bsSingle; property Columns: TListColumns read FColumns write SetColumns; property ColumnClick: Boolean index Ord(lvpColumnClick) read GetProperty write SetProperty default True; property DefaultItemHeight: integer read FDefaultItemHeight write SetDefaultItemHeight; @@ -1044,6 +1043,7 @@ type function FindCaption(StartIndex: Integer; Value: string; Partial, Inclusive, Wrap: Boolean; PartStart: Boolean = True): TListItem; function GetItemAt(x,y: integer): TListItem; property BoundingRect: TRect read GetBoundingRect; + property BorderStyle default bsSingle; property Canvas: TCanvas read FCanvas; property Checkboxes: Boolean index Ord(lvpCheckboxes) read GetProperty write SetProperty default False; property Column[AIndex: Integer]: TListColumn read GetColumnFromIndex; @@ -1071,7 +1071,7 @@ type property Align; property Anchors; property BorderSpacing; -// property BorderStyle; + property BorderStyle; property BorderWidth; property Checkboxes; property Color default clWindow; diff --git a/lcl/interfaces/win32/win32wscomctrls.pp b/lcl/interfaces/win32/win32wscomctrls.pp index a97ab2797c..5252a3cc50 100644 --- a/lcl/interfaces/win32/win32wscomctrls.pp +++ b/lcl/interfaces/win32/win32wscomctrls.pp @@ -130,6 +130,7 @@ type class function GetVisibleRowCount(const ALV: TCustomListView): Integer; override; class procedure SetAllocBy(const ALV: TCustomListView; const AValue: Integer); override; + class procedure SetBorderStyle(const AWinControl: TWinControl; const ABorderStyle: TBorderStyle); override; class procedure SetColor(const AWinControl: TWinControl); override; class procedure SetDefaultItemHeight(const ALV: TCustomListView; const AValue: Integer); override; class procedure SetFont(const AWinControl: TWinControl; const AFont: TFont); override; diff --git a/lcl/interfaces/win32/win32wscustomlistview.inc b/lcl/interfaces/win32/win32wscustomlistview.inc index 28a781689f..c0ae956d08 100644 --- a/lcl/interfaces/win32/win32wscustomlistview.inc +++ b/lcl/interfaces/win32/win32wscustomlistview.inc @@ -488,7 +488,8 @@ begin pClassName := WC_LISTVIEW; WindowTitle := StrCaption; Flags := Flags or LISTVIEWSTYLES[TListView(AWinControl).ViewStyle] or LVS_SINGLESEL or LVS_SHAREIMAGELISTS; - FlagsEx := FlagsEx or WS_EX_CLIENTEDGE; + if TCustomListView(AWinControl).BorderStyle = bsSingle then + FlagsEx := FlagsEx or WS_EX_CLIENTEDGE; end; // create window FinishCreateWindow(AWinControl, Params, false); @@ -678,6 +679,22 @@ begin ListView_SetItemCount(ALV.Handle, AValue); end; +class procedure TWin32WSCustomListView.SetBorderStyle(const AWinControl: TWinControl; const ABorderStyle: TBorderStyle); +var + Handle: HWND; + StyleEx: PtrInt; +begin + if not WSCheckHandleAllocated(AWinControl, 'TWin32WSCustomListView.SetBorder') then + Exit; + Handle := AWinControl.Handle; + StyleEx := GetWindowLong(Handle, GWL_EXSTYLE); + if ABorderStyle = TBorderStyle(bsSingle) Then + StyleEx := StyleEx or WS_EX_CLIENTEDGE + else + StyleEx := StyleEx and not WS_EX_CLIENTEDGE; + SetWindowLong(Handle, GWL_EXSTYLE, StyleEx); +end; + class procedure TWin32WSCustomListView.SetColor(const AWinControl: TWinControl); begin if not WSCheckHandleAllocated(AWinControl, 'TWin32WSCustomListView.SetColor') then