如何在StringGrid当前行第一列也像DBGrid样标出箭头呢? 如何在StringGrid当前行第一列也像DBGrid样标出箭头呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你可以从TStringGrid派生一个子类,在子类中当发生进入单元格事件时,在该行第0列自己显示一个箭头。 箭头怎么上去,我在OnDrawCell中试过,却无法确定当前行位置? const MY_DRAWCELL = WM_USER + 10;type TForm1 = class(TForm) StringGrid1: TStringGrid; procedure StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); procedure FormCreate(Sender: TObject); private { Private declarations } procedure MyDrawCell(var Msg: TMessage); message MY_DRAWCELL; public { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);begin if ARow = TStringGrid(Sender).Row then PostMessage(Handle, MY_DRAWCELL, Rect.Top, 0);end;procedure TForm1.FormCreate(Sender: TObject);begin StringGrid1.DefaultRowHeight := 17; StringGrid1.ColWidths[0] := 11;end;procedure TForm1.MyDrawCell(var Msg: TMessage);const {$J+}vWParam: DWORD = 0;{$J-}begin with StringGrid1.Canvas, Msg do begin ///////Begin 清除上一次的三角 Pen.Color := clBtnFace; Brush.Color := clBtnFace; Polygon([ Point(3, vWParam + 3), Point(8, vWParam + 8), Point(3, vWParam + 13) ]); ///////End 清除上一次的三角 Pen.Color := clBlack; Brush.Color := clBlack; Polygon([ Point(3, WParam + 3), Point(8, WParam + 8), Point(3, WParam + 13) ]); vWParam := WParam; end;end; 求delphi7函数大全 自定义鼠标的问题 怎么让DBGridEh从下拉列表选取值之后将数据提交到数据库中? 高分求助,高人救我!关于image 如果在DLL中调用另外一个DLL中的函数?? 请问学校排课系统的原理是怎么样的,算法如何写啊? 怎样将有密码的ACCESS数据库压缩---救命 在线紧急问题——怎么样让DataSet记住以前的记录,这样我可以连续POST好几次,添加几条类似的记录?? 关于 object pascal 的一些概念性问题,急! 哪儿有ODBC的最新版下载,烦请给出详细网址. Adoquery与oracle的问题! 什么情况下需要应用指针?
MY_DRAWCELL = WM_USER + 10;type
TForm1 = class(TForm)
StringGrid1: TStringGrid;
procedure StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
procedure MyDrawCell(var Msg: TMessage); message MY_DRAWCELL;
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
begin
if ARow = TStringGrid(Sender).Row then
PostMessage(Handle, MY_DRAWCELL, Rect.Top, 0);
end;procedure TForm1.FormCreate(Sender: TObject);
begin
StringGrid1.DefaultRowHeight := 17;
StringGrid1.ColWidths[0] := 11;
end;procedure TForm1.MyDrawCell(var Msg: TMessage);
const
{$J+}vWParam: DWORD = 0;{$J-}
begin
with StringGrid1.Canvas, Msg do
begin
///////Begin 清除上一次的三角
Pen.Color := clBtnFace;
Brush.Color := clBtnFace;
Polygon([
Point(3, vWParam + 3),
Point(8, vWParam + 8),
Point(3, vWParam + 13)
]);
///////End 清除上一次的三角 Pen.Color := clBlack;
Brush.Color := clBlack;
Polygon([
Point(3, WParam + 3),
Point(8, WParam + 8),
Point(3, WParam + 13)
]);
vWParam := WParam;
end;
end;