XLGrid的修改问题。好想将XLGRID改成连接DataSource,(20分)

  • 主题发起人 主题发起人 hrp123
  • 开始时间 开始时间
H

hrp123

Unregistered / Unconfirmed
GUEST, unregistred user!
unit XLSGrid;
interface
uses
SysUtils, Classes, Controls, ExtCtrls, DB, XLGrids;
type
TXLSGrid = class(TXLGrid)
private
{ Private declarations }
protected
{ Protected declarations }
public
{ Public declarations }
published
{ Published declarations }
end;

TXLDataLink = class(TDataLink)
private
FBand: TXLBand;
FModified: Boolean;
FInUpdateData: Boolean;
procedure SetBand(const Value: TXLBand);
protected
procedure ActiveChanged; override;
procedure DataSetChanged; override;
procedure DataSetScrolled(Distance: Integer); override;
procedure EditingChanged; override;
procedure RecordChanged(Field: TField); override;
procedure UpdateData; override;
public
constructor Create(ABand: TXLBand);
destructor Destroy; override;
procedure Modified;
property Band: TXLBand read FBand write SetBand;
end;

TXLBand = class(TPersistent)
private
FName: string;
FDataLink: TXLDataLink;
FRange: TRect;
FSheet: TXLSheet;
FDataSourceName: string;
FStep: Integer;
FDataInfo: TPanel;
FUpInfo, FDownInfo: TLabel;
FPageNo: Integer;
procedure SetName(const Value: string);
procedure SetRange(const Value: TRect);
procedure SetSheet(const Value: TXLSheet);
procedure SetDataSourceName(const Value: string);
procedure SetStep(const Value: Integer);
function GetDataSet: TDataSet;
function GetDataSource: TDataSource;
procedure DisCellValue(ACell: TXLCell; AValue: Integer; var Stop: Boolean);
procedure MoveToFirst(Sender: TObject);
procedure MoveToLast(Sender: TObject);
procedure SetPageNo(const Value: Integer);
protected
procedure Load(AStream: TXLStream);
procedure Save(AStream: TXLStream);
public
constructor Create(AName: string; ASheet: TXLSheet; ARect: TRect);
destructor Destroy; override;
function LoadFromStream(AStream: TXLStream): Boolean;
procedure SaveToStream(AStream: TXLStream);
procedure ActiveChanged(Active: Boolean);
procedure DataSetChanged;
procedure DataSetScrolled(Distance: Integer);
procedure EditingChanged;
procedure RecordChanged(Field: TField);
procedure UpdateData;
procedure DisplayDataInfo;
property Step: Integer read FStep write SetStep;
property PageNo: Integer read FPageNo write SetPageNo;
property Name: string read FName write SetName;
property Range: TRect read FRange write SetRange;
property DataSet: TDataSet read GetDataSet;
property Sheet: TXLSheet read FSheet write SetSheet;
property DataSource: TDataSource read GetDataSource;
property DataSourceName: string read FDataSourceName write SetDataSourceName;
end;

TXLBandList = class(TPersistent)
private
FBandList: TStringList;
FSheet: TXLSheet;
function GetBand(AIndex: Integer): TXLBand;
procedure SetSheet(const Value: TXLSheet);
function GetCount: Integer;
procedure SetBandName;
protected
procedure Load(AStream: TXLStream);
procedure Save(AStream: TXLStream);
public
constructor Create(ASheet: TXLSheet);
destructor Destroy; override;
function LoadFromStream(AStream: TXLStream): Boolean;
procedure SaveToStream(AStream: TXLStream);
function Add(AName: string; ARect: TRect): TXLBand;
function Delete(AName: string): Boolean;
function BandByName(AName: string): TXLBand;
property Items[AIndex: Integer]: TXLBand read GetBand; default;
property Sheet: TXLSheet read FSheet write SetSheet;
property Count: Integer read GetCount;
end;
procedure Register;
implementation
//以上是文件头部份但总是到TxLDataLink下的FBand: TXLBand;时,总提示TxlBand没声明。但我已经在下面有TxlBand= Classs....了呀不知何故。不必哪位富翁实现了以上修改?可否给一份我?急用。
//另外,谁有TXLSheet Designer的源码?
 
TXLBand = class;
TXLDataLink = class(TDataLink)
end;
提前声同就行了。
 
如果提前声明的话,那么TxlBand中的TXlDataLink将提示没有声明。
 
接受答案了.
 

Similar threads

I
回复
0
查看
654
import
I
I
回复
0
查看
646
import
I
I
回复
0
查看
560
import
I
I
回复
0
查看
570
import
I
后退
顶部