📄 lvimpl.pas
字号:
unit LVImpl;
interface
uses
Windows, ActiveX, Classes, Controls, Graphics, Menus, Forms, StdCtrls,
ComServ, StdVCL, AXCtrls, LVCtrl_TLB, ListView2, ComCtrls, LVItems;
type
TListViewX = class(TActiveXControl, IListViewX)
private
{ Private declarations }
FDelphiControl: TListView2;
FEvents: IListViewXEvents;
FItems: IListItems;
procedure ClickEvent(Sender: TObject);
procedure DataHintEvent(Sender: TObject; StartIndex, EndIndex: Integer);
procedure DblClickEvent(Sender: TObject);
procedure KeyPressEvent(Sender: TObject; var Key: Char);
procedure ResizeEvent(Sender: TObject);
protected
{ Protected declarations }
procedure DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage); override;
procedure EventSinkChanged(const EventSink: IUnknown); override;
procedure InitializeControl; override;
function AlphaSort: WordBool; safecall;
function ClassNameIs(const Name: WideString): WordBool; safecall;
function DrawTextBiDiModeFlags(Flags: Integer): Integer; safecall;
function DrawTextBiDiModeFlagsReadingOnly: Integer; safecall;
function Get_AllocBy: Integer; safecall;
function Get_BiDiMode: TxBiDiMode; safecall;
function Get_BorderStyle: TxBorderStyle; safecall;
function Get_Checkboxes: WordBool; safecall;
function Get_Color: OLE_COLOR; safecall;
function Get_ColumnClick: WordBool; safecall;
function Get_Ctl3D: WordBool; safecall;
function Get_Cursor: Smallint; safecall;
function Get_DoubleBuffered: WordBool; safecall;
function Get_DragCursor: Smallint; safecall;
function Get_DragMode: TxDragMode; safecall;
function Get_Enabled: WordBool; safecall;
function Get_FlatScrollBars: WordBool; safecall;
function Get_Font: IFontDisp; safecall;
function Get_FullDrag: WordBool; safecall;
function Get_GridLines: WordBool; safecall;
function Get_HideSelection: WordBool; safecall;
function Get_HotTrack: WordBool; safecall;
function Get_MultiSelect: WordBool; safecall;
function Get_OwnerData: WordBool; safecall;
function Get_OwnerDraw: WordBool; safecall;
function Get_ParentColor: WordBool; safecall;
function Get_ParentFont: WordBool; safecall;
function Get_ReadOnly: WordBool; safecall;
function Get_RowSelect: WordBool; safecall;
function Get_SelCount: Integer; safecall;
function Get_ShowColumnHeaders: WordBool; safecall;
function Get_SortType: TxSortType; safecall;
function Get_ViewStyle: TxViewStyle; safecall;
function Get_Visible: WordBool; safecall;
function Get_VisibleRowCount: Integer; safecall;
function GetControlsAlignment: TxAlignment; safecall;
function GetSearchString: WideString; safecall;
function IsEditing: WordBool; safecall;
function IsRightToLeft: WordBool; safecall;
function StringWidth(const S: WideString): Integer; safecall;
function UseRightToLeftAlignment: WordBool; safecall;
function UseRightToLeftReading: WordBool; safecall;
function UseRightToLeftScrollBar: WordBool; safecall;
procedure _Set_Font(const Value: IFontDisp); safecall;
procedure AboutBox; safecall;
procedure Arrange(Code: TxListArrangement); safecall;
procedure FlipChildren(AllLevels: WordBool); safecall;
procedure InitiateAction; safecall;
procedure Scroll(DX, DY: Integer); safecall;
procedure Set_AllocBy(Value: Integer); safecall;
procedure Set_BiDiMode(Value: TxBiDiMode); safecall;
procedure Set_BorderStyle(Value: TxBorderStyle); safecall;
procedure Set_Checkboxes(Value: WordBool); safecall;
procedure Set_Color(Value: OLE_COLOR); safecall;
procedure Set_ColumnClick(Value: WordBool); safecall;
procedure Set_Ctl3D(Value: WordBool); safecall;
procedure Set_Cursor(Value: Smallint); safecall;
procedure Set_DoubleBuffered(Value: WordBool); safecall;
procedure Set_DragCursor(Value: Smallint); safecall;
procedure Set_DragMode(Value: TxDragMode); safecall;
procedure Set_Enabled(Value: WordBool); safecall;
procedure Set_FlatScrollBars(Value: WordBool); safecall;
procedure Set_Font(var Value: IFontDisp); safecall;
procedure Set_FullDrag(Value: WordBool); safecall;
procedure Set_GridLines(Value: WordBool); safecall;
procedure Set_HideSelection(Value: WordBool); safecall;
procedure Set_HotTrack(Value: WordBool); safecall;
procedure Set_MultiSelect(Value: WordBool); safecall;
procedure Set_OwnerData(Value: WordBool); safecall;
procedure Set_OwnerDraw(Value: WordBool); safecall;
procedure Set_ParentColor(Value: WordBool); safecall;
procedure Set_ParentFont(Value: WordBool); safecall;
procedure Set_ReadOnly(Value: WordBool); safecall;
procedure Set_RowSelect(Value: WordBool); safecall;
procedure Set_ShowColumnHeaders(Value: WordBool); safecall;
procedure Set_SortType(Value: TxSortType); safecall;
procedure Set_ViewStyle(Value: TxViewStyle); safecall;
procedure Set_Visible(Value: WordBool); safecall;
procedure UpdateItems(FirstIndex, LastIndex: Integer); safecall;
function Get_Items: IListItems; safecall;
end;
implementation
uses ComObj, About;
{ TListViewX }
procedure TListViewX.DefinePropertyPages(DefinePropertyPage: TDefinePropertyPage);
begin
{ Define property pages here. Property pages are defined by calling
DefinePropertyPage with the class id of the page. For example,
DefinePropertyPage(Class_ListViewXPage); }
end;
procedure TListViewX.EventSinkChanged(const EventSink: IUnknown);
begin
FEvents := EventSink as IListViewXEvents;
end;
procedure TListViewX.InitializeControl;
begin
FDelphiControl := Control as TListView2;
FDelphiControl.OnClick := ClickEvent;
FDelphiControl.OnDataHint := DataHintEvent;
FDelphiControl.OnDblClick := DblClickEvent;
FDelphiControl.OnKeyPress := KeyPressEvent;
FDelphiControl.OnResize := ResizeEvent;
FItems := LVItems.TListItems.Create(FDelphiControl.Items);
end;
function TListViewX.AlphaSort: WordBool;
begin
Result := FDelphiControl.AlphaSort;
end;
function TListViewX.ClassNameIs(const Name: WideString): WordBool;
begin
Result := FDelphiControl.ClassNameIs(Name);
end;
function TListViewX.DrawTextBiDiModeFlags(Flags: Integer): Integer;
begin
Result := FDelphiControl.DrawTextBiDiModeFlags(Flags);
end;
function TListViewX.DrawTextBiDiModeFlagsReadingOnly: Integer;
begin
Result := FDelphiControl.DrawTextBiDiModeFlagsReadingOnly;
end;
function TListViewX.Get_AllocBy: Integer;
begin
Result := FDelphiControl.AllocBy;
end;
function TListViewX.Get_BiDiMode: TxBiDiMode;
begin
Result := Ord(FDelphiControl.BiDiMode);
end;
function TListViewX.Get_BorderStyle: TxBorderStyle;
begin
Result := Ord(FDelphiControl.BorderStyle);
end;
function TListViewX.Get_Checkboxes: WordBool;
begin
Result := FDelphiControl.Checkboxes;
end;
function TListViewX.Get_Color: OLE_COLOR;
begin
Result := OLE_COLOR(FDelphiControl.Color);
end;
function TListViewX.Get_ColumnClick: WordBool;
begin
Result := FDelphiControl.ColumnClick;
end;
function TListViewX.Get_Ctl3D: WordBool;
begin
Result := FDelphiControl.Ctl3D;
end;
function TListViewX.Get_Cursor: Smallint;
begin
Result := Smallint(FDelphiControl.Cursor);
end;
function TListViewX.Get_DoubleBuffered: WordBool;
begin
Result := FDelphiControl.DoubleBuffered;
end;
function TListViewX.Get_DragCursor: Smallint;
begin
Result := Smallint(FDelphiControl.DragCursor);
end;
function TListViewX.Get_DragMode: TxDragMode;
begin
Result := Ord(FDelphiControl.DragMode);
end;
function TListViewX.Get_Enabled: WordBool;
begin
Result := FDelphiControl.Enabled;
end;
function TListViewX.Get_FlatScrollBars: WordBool;
begin
Result := FDelphiControl.FlatScrollBars;
end;
function TListViewX.Get_Font: IFontDisp;
begin
GetOleFont(FDelphiControl.Font, Result);
end;
function TListViewX.Get_FullDrag: WordBool;
begin
Result := FDelphiControl.FullDrag;
end;
function TListViewX.Get_GridLines: WordBool;
begin
Result := FDelphiControl.GridLines;
end;
function TListViewX.Get_HideSelection: WordBool;
begin
Result := FDelphiControl.HideSelection;
end;
function TListViewX.Get_HotTrack: WordBool;
begin
Result := FDelphiControl.HotTrack;
end;
function TListViewX.Get_MultiSelect: WordBool;
begin
Result := FDelphiControl.MultiSelect;
end;
function TListViewX.Get_OwnerData: WordBool;
begin
Result := FDelphiControl.OwnerData;
end;
function TListViewX.Get_OwnerDraw: WordBool;
begin
Result := FDelphiControl.OwnerDraw;
end;
function TListViewX.Get_ParentColor: WordBool;
begin
Result := FDelphiControl.ParentColor;
end;
function TListViewX.Get_ParentFont: WordBool;
begin
Result := FDelphiControl.ParentFont;
end;
function TListViewX.Get_ReadOnly: WordBool;
begin
Result := FDelphiControl.ReadOnly;
end;
function TListViewX.Get_RowSelect: WordBool;
begin
Result := FDelphiControl.RowSelect;
end;
function TListViewX.Get_SelCount: Integer;
begin
Result := FDelphiControl.SelCount;
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -