⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tsdbgrid.pas

📁 企业进销存管理系统
💻 PAS
📖 第 1 页 / 共 5 页
字号:
        procedure ResetMaxLength;
        procedure ResetVisible;
        procedure ResetWidth;

        property MaxTextWidth : Integer read GetMaxTextWidth;
        property Combo: TtsDBCombo read GetDBCombo write SetDBCombo;
        property DatasetField: TField read GetDatasetField write SetDatasetField;
        property Field: TtsDBField read FDBField;

    published
        property ComboDatasource: TDatasource read GetComboDataSource write SetComboDataSource;
    end;

    {TtsDBGridCols}
    {List of all columns in TtsCustomDBGrid, implemented as an array of TtsDBCol}

    TtsDBGridCols = class(TtsGridCols)
    protected
        FFieldState: TtsFieldState;

        function  GetDBCol(DataCol: Variant): TtsDBCol;
        function  GetDBGrid: TtsCustomDBGrid;
        procedure SetFieldState(Value: TtsFieldState);
        function  FindField(Field: TField): TtsDBCol;

        function CreateCol: TtsCol; override;
        property Grid: TtsCustomDBGrid read GetDBGrid;

    public
        property Col[DataCol: Variant]: TtsDBCol read GetDBCol; default;
        property FieldState: TtsFieldState read FFieldState write SetFieldState;
    end;

    {TtsDBRowElement}
    {Element for storing row properties in a binary tree.}

    TtsDBRowElement = class(TtsCustomPropElement)
    protected
        FDataRow: Variant;

        procedure FontChange(Sender: TObject); override;
        function  GetGrid: TtsCustomDBGrid;
    public
        constructor Create(Grid: TtsBaseGrid; DataRow: Variant);
        destructor  Destroy; override;

        procedure Assign(Source: TtsCustomElement); override;
        function  Compare(NodeSet: TtsCustomSet; Value: TtsSetElement): TtsSetOrder; override;
        function  CompareKey(NodeSet: TtsCustomSet; const KeyValue: array of const): TtsSetOrder; override;

        property Grid: TtsCustomDBGrid read GetGrid;
    end;

    {TtsDBCellElement}
    {Element for storing cell properties in a binary tree.}

    TtsDBCellElement = class(TtsCustomPropElement)
    protected
        FDataCol: Longint;
        FDataRow: Variant;

        procedure FontChange(Sender: TObject); override;
        function  GetGrid: TtsCustomDBGrid;
        procedure AssignCombo; override;

    public
        constructor Create(Grid: TtsBaseGrid; DataCol: Longint; DataRow: Variant);
        destructor  Destroy; override;

        procedure Assign(Source: TtsCustomElement); override;
        function  Compare(NodeSet: TtsCustomSet; Value: TtsSetElement): TtsSetOrder; override;
        function  CompareKey(NodeSet: TtsCustomSet; const KeyValue: array of const): TtsSetOrder; override;

        property Grid: TtsCustomDBGrid read GetGrid;
    end;

    {TtsDBRowPropSet}
    {Binary tree for storage of TtsCustomDBGrid row properties}

    TtsDBRowPropSet = class(TtsCustomPropSet)
    protected
        function  CreateElement(const KeyValue: array of const): TtsCustomElement; override;
        procedure DeleteElement(Element: TtsCustomElement); override;
        function  CheckDelete(Element: TtsCustomElement): Boolean; override;
        function  SetProperty(const KeyValue: array of const; var Element: TtsCustomElement;
                              const Value: Variant; Prop: TtsProperty; PropId: Integer; Redraw: Boolean): Boolean; override;
        function  GetGrid: TtsCustomDBGrid;

        property Grid: TtsCustomDBGrid read GetGrid;
    end;

    {TtsDBCellPropSet}
    {Binary tree for storage of TtsCustomDBGrid cell properties}

    TtsDBCellPropSet = class(TtsCustomPropSet)
    protected
        procedure CheckRedraw(DataCol: Longint; DataRow: Variant; CheckInvalidate: Boolean);
        function  CreateElement(const KeyValue: array of const): TtsCustomElement; override;
        procedure DeleteElement(Element: TtsCustomElement); override;
        function  CheckDelete(Element: TtsCustomElement): Boolean; override;
        function  SetProperty(const KeyValue: array of const; var Element: TtsCustomElement;
                              const Value: Variant; Prop: TtsProperty; PropId: Integer; Redraw: Boolean): Boolean; override;
        function  GetGrid: TtsCustomDBGrid;

        property Grid: TtsCustomDBGrid read GetGrid;
    end;

    {TtsDBCell}
    {Used by the TopGrid component editor to set cell properties}

    TtsDBCell = class(TtsCell)
    protected
        FElement: TtsDBCellElement;
        FAssignedProps: TtsProperties;

        function  GetDBGrid: TtsCustomDBGrid;
        procedure SetDBGrid(Value: TtsCustomDBGrid);
        function  GetElement: TtsDBCellElement;

        function  GetColor: TColor; override;
        procedure SetColor(Value: TColor); override;
        function  GetControlType: TtsControlType; override;
        procedure SetControlType(Value: TtsControlType); override;
        function  GetSpinOptions: TtsSpinOptions; override;
        procedure SetSpinOptions(Value: TtsSpinOptions); override;
        function  GetSpinIncrement: Double; override;
        procedure SetSpinIncrement(Value: Double); override;
        function  GetFont: TFont; override;
        procedure SetFont(Value: TFont); override;
        function  GetParentFont: Boolean; override;
        procedure SetParentFont(Value: Boolean); override;
        function  GetAlignment: TAlignment; override;
        procedure SetAlignment(Value: TAlignment); override;
        function  GetAlign: Boolean; override;
        procedure SetAlign(Value: Boolean); override;
        function  GetHorzAlignment: TtsHorzAlignment; override;
        procedure SetHorzAlignment(Value: TtsHorzAlignment); override;
        function  GetVertAlignment: TtsVertAlignment; override;
        procedure SetVertAlignment(Value: TtsVertAlignment); override;
        function  GetIs3D: Boolean; override;
        procedure SetIs3D(Value: Boolean); override;
        function  GetWordWrap: TtsWordWrap; override;
        procedure SetWordWrap(Value: TtswordWrap); override;
        function  GetButtonType: TtsButtonType; override;
        procedure SetButtonType(Value: TtsButtonType); override;
        function  GetDropDownStyle: TtsDropDownStyle; override;
        procedure SetDropDownStyle(Value: TtsDropDownStyle); override;
        function  GetReadOnly: TtsReadOnly; override;
        procedure SetReadOnly(Value: TtsReadOnly); override;
        function  GetMaskName: string; override;
        procedure SetMaskName(Value: string); override;
        function  GetAutoCreateFont: Boolean; override;
        procedure SetAutoCreateFont(Value: Boolean); override;
        function  GetCombo: TtsCombo; override;
        procedure SetCombo(Value: TtsCombo); override;
        procedure AssignCombo; override;
        function  GetParentCombo: Boolean; override;
        procedure SetParentCombo(Value: Boolean); override;
        function  GetStretchPicture: TtsDrawOption; override;
        procedure SetStretchPicture(Value: TtsDrawOption); override;
        function  GetShrinkPicture: TtsDrawOption; override;
        procedure SetShrinkPicture(Value: TtsDrawOption); override;
        function  GetCenterPicture: TtsDrawOption; override;
        procedure SetCenterPicture(Value: TtsDrawOption); override;
        function  GetKeepAspectRatio: TtsDrawOption; override;
        procedure SetKeepAspectRatio(Value: TtsDrawOption); override;
        function  GetDateTimeDef: TtsDateTimeDefComponent; override;
        procedure SetDateTimeDef(Value: TtsDateTimeDefComponent); override;

        property Element: TtsDBCellElement read GetElement;

    public
        constructor Create(Grid: TtsBaseGrid; DataCol: Longint; DataRow: Variant);
        destructor  Destroy; override;
        property  Grid: TtsCustomDBGrid read GetDBGrid write SetDBGrid;
    end;

    TtsDBRow = class(TtsDesignRow)
    protected
        FSelected: Boolean;
        FElement: TtsDBRowElement;
        FAssignedProps: TtsProperties;

        function  GetGrid: TtsCustomDBGrid;
        procedure SetGrid(Value: TtsCustomDBGrid);
        function  GetElement: TtsDBRowElement;

        function  GetColor: TColor; override;
        procedure SetColor(Value: TColor); override;
        function  GetDisplayRow: Longint; override;
        procedure SetDisplayRow(Value: Longint); override;
        function  GetFont: TFont; override;
        procedure SetFont(Value: TFont); override;
        function  GetCombo: TtsCombo; override;
        procedure SetCombo(Value: TtsCombo); override;
        procedure AssignCombo; override;
        function  GetParentCombo: Boolean; override;
        procedure SetParentCombo(Value: Boolean); override;
        function  GetParentFont: Boolean; override;
        procedure SetParentFont(Value: Boolean); override;
        function  GetHeight: Integer; override;
        procedure SetHeight(Value: Integer); override;
        function  GetAlignment: TAlignment; override;
        procedure SetAlignment(Value: TAlignment); override;
        function  GetAlign: Boolean; override;
        procedure SetAlign(Value: Boolean); override;
        function  GetHorzAlignment: TtsHorzAlignment; override;
        procedure SetHorzAlignment(Value: TtsHorzAlignment); override;
        function  GetVertAlignment: TtsVertAlignment; override;
        procedure SetVertAlignment(Value: TtsVertAlignment); override;
        function  GetChanged: Boolean; override;
        procedure SetChanged(Value: Boolean); override;
        function  GetIs3D: Boolean; override;
        procedure SetIs3D(Value: Boolean); override;
        function  GetWordWrap: TtsWordWrap; override;
        procedure SetWordWrap(Value: TtswordWrap); override;
        function  GetButtonType: TtsButtonType; override;
        procedure SetButtonType(Value: TtsButtonType); override;
        function  GetReadOnly: Boolean; override;
        procedure SetReadOnly(Value: Boolean); override;
        function  GetMaskName: string; override;
        procedure SetMaskName(Value: string); override;
        function  GetSelected: Boolean; override;
        procedure SetSelected(Value: Boolean); override;
        function  GetVisible: Boolean; override;
        procedure SetVisible(Value: Boolean); override;
        function  GetAutoCreateFont: Boolean; override;
        procedure SetAutoCreateFont(Value: Boolean); override;
        function  GetId: Longint; override;
        function  GetStretchPicture: TtsDrawOption; override;
        procedure SetStretchPicture(Value: TtsDrawOption); override;
        function  GetShrinkPicture: TtsDrawOption; override;
        procedure SetShrinkPicture(Value: TtsDrawOption); override;
        function  GetCenterPicture: TtsDrawOption; override;
        procedure SetCenterPicture(Value: TtsDrawOption); override;
        function  GetKeepAspectRatio: TtsDrawOption; override;
        procedure SetKeepAspectRatio(Value: TtsDrawOption); override;
        function  GetControlType: TtsControlType; override;
        procedure SetControlType(Value: TtsControlType); override;
        function  GetSpinOptions: TtsSpinOptions; override;
        procedure SetSpinOptions(Value: TtsSpinOptions); override;
        function  GetSpinIncrement: Double; override;
        procedure SetSpinIncrement(Value: Double); override;
        function  GetDateTimeDef: TtsDateTimeDefComponent; override;
        procedure SetDateTimeDef(Value: TtsDateTimeDefComponent); override;
        function  GetDropDownStyle: TtsDropDownStyle; override;
        procedure SetDropDownStyle(Value: TtsDropDownStyle); override;

        function  StoreDisplayRow: Boolean; override;
        function  StoreHeight: Boolean; override;

        property Element: TtsDBRowElement read GetElement;

    public
        constructor Create(Grid: TtsBaseGrid; DataRow: Variant);
        destructor  Destroy; override;
        procedure Assign(Source: TPersistent); override;

        //Design time property
        property  AutoCreateFont: Boolean read GetAutoCreateFont write SetAutoCreateFont;

        property  Grid: TtsCustomDBGrid read GetGrid write SetGrid;
        property  DataRow: Variant read FDataRow write FDataRow;
    end;

    {TtsBookmarkSetNode}
    {Element for storing bookmarks in a binary tree}

    TtsBookmarkSetNode = class(TtsStringSetNode)
    public
        function Compare(NodeSet: TtsCustomSet; NodeValue : Pointer) : TtsSetOrder; override;
    end;

    {TtsBookmarkSetNode}
    {Binary tree for storing bookmarks of selected records}

    TtsBookmarkSet = class(TtsStringSet)
    protected

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -