小弟自定义了一个空件mydbgrid(就是想把原来的颜色改掉),我已经把它安装到了组件页上,但是不能放到窗口上,不知是那步出错了,请各位大侠指教,谢谢!代码如下:
unit mydbgrid;interfaceuses
Windows, Messages, SysUtils, Classes, Controls, Grids, DBGrids;type
tmydbgrid = class(tdbgrid)
private
{ Private declarations }
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
{ Published declarations }
end;procedure Register;implementationprocedure Register;
begin
RegisterComponents('mycomponent', [tmydbgrid]);
end;{ tmydbgrid }constructor tmydbgrid.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
if DataSource.DataSet.RecNo mod 2 = 0 then
begin
Color := RGB(191, 255, 150);//定义背景颜色
end
else
Color:= RGB(191, 255, 223); //定义背景颜色
end;
destructor tmydbgrid.Destroy;
begin
inherited Destroy;
end;end.
unit mydbgrid;interfaceuses
Windows, Messages, SysUtils, Classes, Controls, Grids, DBGrids;type
tmydbgrid = class(tdbgrid)
private
{ Private declarations }
protected
{ Protected declarations }
public
{ Public declarations }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
{ Published declarations }
end;procedure Register;implementationprocedure Register;
begin
RegisterComponents('mycomponent', [tmydbgrid]);
end;{ tmydbgrid }constructor tmydbgrid.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
if DataSource.DataSet.RecNo mod 2 = 0 then
begin
Color := RGB(191, 255, 150);//定义背景颜色
end
else
Color:= RGB(191, 255, 223); //定义背景颜色
end;
destructor tmydbgrid.Destroy;
begin
inherited Destroy;
end;end.
解决方案 »
- 请教一个开发c/s程序的思路的问题,请指教
- 展示一下我研发的两款三层技术组件MateyDB、MateyFrame,还请多提供些意见。
- 高分求助“怎样在一个可执行程序中,显示多个任务栏”
- Zebra 888-TT不能打印汉字?救急!!!!
- 超难!非高手勿进!给100分!
- 有个贴子发了几个月没人回答,大家来UP下,我也给分,我想结贴
- 一个简单问题
- 该怎么办啊,行不行啊???在线等待解答!!!
- 如何获得未知API函数的调用形式及参数?
- 试看VB7如何抄袭Delphi(2)
- 我想学DELPHI啊~~有没有好心人拉我一把~!~~~~~~~~~~~100分给第一个解决问题的人
- 如何在TStringGrid控件中动态生成并显示TComboBox控件?
[email protected]
Access violation at address 51001 CBA in moudule 'dclusr.bpl'.
Read of address 000000030.
谢谢各位大侠!