delphi 中DBgrid 的问题
各位大哥帮忙啊我想在dbgrid中鼠标光标放到那行光标所在的整行变色并且能行内数据可以编辑...
各位大哥帮忙啊 我想在dbgrid中 鼠标光标放到那行 光标所在的整行变色 并且能行内数据可以编辑
展开
2个回答
2013-08-30
展开全部
这个就得在鼠标的move事件中写代码了 只要光标定位了 整行变色数据可以编辑就简单了 修改相应的属性即可
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
金山毒霸
2024-10-31 广告
2024-10-31 广告
大部分系统错误,是因为某些DLL文件丢失造成的,比如未安装DirectX9或DirectX 9.0组件已损坏、缺少Visual C ++库、未安装.net库。解决方法如下:一、 手动解决方法1、先确定电脑操作系统是多少位的,现在的电脑一般都...
点击进入详情页
本回答由金山毒霸提供
2013-08-30
展开全部
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, OracleData, Oracle, Grids, DBGrids;type
TMyDBGrid = class(TDBGrid);
TForm1 = class(TForm)
DataSource1: TDataSource;
DBGrid1: TDBGrid;
OracleSession1: TOracleSession;
OracleDataSet1: TOracleDataSet;
procedure DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
procedure DBGrid1ColEnter(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
with TMyDBGrid(Sender) do
begin
if DataLink.ActiveRecord=Row-1 then
begin
Canvas.Font.Color:=clWhite;
Canvas.Brush.Color:=clBlue;
end
else
begin
Canvas.Brush.Color:=Color;
Canvas.Font.Color:=Font.Color;
end;
DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;end;procedure TForm1.DBGrid1ColEnter(Sender: TObject);
begin
// DBGrid1.Options:= DBGrid1.Options - [dgRowSelect];
end;end.
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, DB, OracleData, Oracle, Grids, DBGrids;type
TMyDBGrid = class(TDBGrid);
TForm1 = class(TForm)
DataSource1: TDataSource;
DBGrid1: TDBGrid;
OracleSession1: TOracleSession;
OracleDataSet1: TOracleDataSet;
procedure DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
procedure DBGrid1ColEnter(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
with TMyDBGrid(Sender) do
begin
if DataLink.ActiveRecord=Row-1 then
begin
Canvas.Font.Color:=clWhite;
Canvas.Brush.Color:=clBlue;
end
else
begin
Canvas.Brush.Color:=Color;
Canvas.Font.Color:=Font.Color;
end;
DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;end;procedure TForm1.DBGrid1ColEnter(Sender: TObject);
begin
// DBGrid1.Options:= DBGrid1.Options - [dgRowSelect];
end;end.
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询