本人用delphi写了个activex 里面有个属性用到了TStrings类,但是那个activex组件引用到C#中那个属性就没有了,现在怎么解决呀,这个控件是个像P2P终结者里面的时间棒控件,有高手能提点下嘛.
TCPTimeBar = class(TCustomControl)
private
downx, downy, lastx, lasty: Integer;
FTimeRangeItems: TTimeRangeItems;
FColumnCount: Integer;
FColumnCaption: TStrings;
FCaptionWidth: Integer;
FHeaderHeight: Integer;
FDrawColor: TColor;
FOnDrawTimeBar: TDrawTimeBar;
FOnDrawCompleted: TNotifyEvent;
FStartTime: TTime;
FEndTime: TTime;
FSpan: Double;
function GetColor: TColor;
procedure SetColor(const Value: TColor);
procedure SetTimeRangeItems(const Value: TTimeRangeItems);
procedure SetColumnCount(const Value: Integer);
procedure SetColumnCaption(const Value: TStrings);
function GetColumnWidth: integer;
procedure SetCaptionWidth(const Value: Integer);
procedure SetFHeaderHeight(const Value: Integer);
function GetHeaderWidth: Integer;
{ Private declarations }
protected
procedure WMLButtonDown(var Message: TWMLButtonDown); message WM_LBUTTONDOWN;
procedure WMMouseMove(var Message: TWMMouseMove); message WM_MOUSEMOVE;
procedure WMLButtonUp(var Message: TWMLButtonUp); message WM_LBUTTONUP;
procedure Paint; override;
procedure Box(x1, y1, x2, y2: integer);
{ Protected declarations }
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure ReArrangeItem;
property ColumnWidth: integer read GetColumnWidth;
property HeaderWidth: Integer read GetHeaderWidth;
published
property Align;
property Color: TColor read GetColor write SetColor;
property ColumnCount: Integer read FColumnCount write SetColumnCount default 1;
property ColumnCaption: TStrings read FColumnCaption write SetColumnCaption;
property CaptionWidth: Integer read FCaptionWidth write SetCaptionWidth default 40;
property HeaderHeight: Integer read FHeaderHeight write SetFHeaderHeight default 18;
property TimeRangeItems: TTimeRangeItems read FTimeRangeItems write SetTimeRangeItems;
property DrawColor: TColor read FDrawColor write FDrawColor;
property OnDrawTimeBar: TDrawTimeBar read FOnDrawTimeBar write FOnDrawTimeBar;
property OnDrawCompleted: TNotifyEvent read FOnDrawCompleted write FOnDrawCompleted;
{ Published declarations }
end;
TCPTimeBar = class(TCustomControl)
private
downx, downy, lastx, lasty: Integer;
FTimeRangeItems: TTimeRangeItems;
FColumnCount: Integer;
FColumnCaption: TStrings;
FCaptionWidth: Integer;
FHeaderHeight: Integer;
FDrawColor: TColor;
FOnDrawTimeBar: TDrawTimeBar;
FOnDrawCompleted: TNotifyEvent;
FStartTime: TTime;
FEndTime: TTime;
FSpan: Double;
function GetColor: TColor;
procedure SetColor(const Value: TColor);
procedure SetTimeRangeItems(const Value: TTimeRangeItems);
procedure SetColumnCount(const Value: Integer);
procedure SetColumnCaption(const Value: TStrings);
function GetColumnWidth: integer;
procedure SetCaptionWidth(const Value: Integer);
procedure SetFHeaderHeight(const Value: Integer);
function GetHeaderWidth: Integer;
{ Private declarations }
protected
procedure WMLButtonDown(var Message: TWMLButtonDown); message WM_LBUTTONDOWN;
procedure WMMouseMove(var Message: TWMMouseMove); message WM_MOUSEMOVE;
procedure WMLButtonUp(var Message: TWMLButtonUp); message WM_LBUTTONUP;
procedure Paint; override;
procedure Box(x1, y1, x2, y2: integer);
{ Protected declarations }
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure ReArrangeItem;
property ColumnWidth: integer read GetColumnWidth;
property HeaderWidth: Integer read GetHeaderWidth;
published
property Align;
property Color: TColor read GetColor write SetColor;
property ColumnCount: Integer read FColumnCount write SetColumnCount default 1;
property ColumnCaption: TStrings read FColumnCaption write SetColumnCaption;
property CaptionWidth: Integer read FCaptionWidth write SetCaptionWidth default 40;
property HeaderHeight: Integer read FHeaderHeight write SetFHeaderHeight default 18;
property TimeRangeItems: TTimeRangeItems read FTimeRangeItems write SetTimeRangeItems;
property DrawColor: TColor read FDrawColor write FDrawColor;
property OnDrawTimeBar: TDrawTimeBar read FOnDrawTimeBar write FOnDrawTimeBar;
property OnDrawCompleted: TNotifyEvent read FOnDrawCompleted write FOnDrawCompleted;
{ Published declarations }
end;
TStrings 类是 delphi专有的,你做成activex,估计也只有delphi认得出来,估计delphi作的activex没有很好的把delphi专有类转化好,所以你的C#认不出来,解决办法估计只能是重写你的delphi的 activex的代码,把这个属性重新定义(最好用标准的类型),不能使用delphi专有的类型TStrings定义。