procedure TForm9.StringGrid1Click(Sender: TObject);
var i,j:integer;
rect:TRect;
str:string;
begin
for i:=1 to stringgrid1.RowCount do
begin
stringgrid1.Cells[0,i]:='';
for j:=1 to 6 do
begin
str:=stringgrid1.Cells[j,i];
stringgrid1.Canvas.Brush.Color:=clwhite;
rect:=stringgrid1.CellRect(j,i);
stringgrid1.Canvas.FillRect(rect);
stringgrid1.Canvas.Font.Color:=cldefault;
stringgrid1.Canvas.TextRect(rect,rect.Left,rect.Top,str);
end;
end;
stringgrid1.Cells[0,stringgrid1.Row]:='->';
for i:=1 to 6 do
begin
str:=stringgrid1.Cells[i,stringgrid1.Row];
stringgrid1.Canvas.Brush.Color:=cllime;
rect:=stringgrid1.CellRect(i,stringgrid1.Row);
stringgrid1.Canvas.FillRect(rect);
stringgrid1.Canvas.Font.Color:=cldefault;
stringgrid1.Canvas.TextRect(rect,rect.Left,rect.Top,str);
end;
// showmessage(stringgrid1.Cells[1,stringgrid1.Row]);
end;
var i,j:integer;
rect:TRect;
str:string;
begin
for i:=1 to stringgrid1.RowCount do
begin
stringgrid1.Cells[0,i]:='';
for j:=1 to 6 do
begin
str:=stringgrid1.Cells[j,i];
stringgrid1.Canvas.Brush.Color:=clwhite;
rect:=stringgrid1.CellRect(j,i);
stringgrid1.Canvas.FillRect(rect);
stringgrid1.Canvas.Font.Color:=cldefault;
stringgrid1.Canvas.TextRect(rect,rect.Left,rect.Top,str);
end;
end;
stringgrid1.Cells[0,stringgrid1.Row]:='->';
for i:=1 to 6 do
begin
str:=stringgrid1.Cells[i,stringgrid1.Row];
stringgrid1.Canvas.Brush.Color:=cllime;
rect:=stringgrid1.CellRect(i,stringgrid1.Row);
stringgrid1.Canvas.FillRect(rect);
stringgrid1.Canvas.Font.Color:=cldefault;
stringgrid1.Canvas.TextRect(rect,rect.Left,rect.Top,str);
end;
// showmessage(stringgrid1.Cells[1,stringgrid1.Row]);
end;
解决方案 »
- 请问delphi7能开发基于asp或者asp.net的B/S结构的系统吗?
- ASTA存贮过程异步出错
- 各位老师;当dabase1 的LoginPrompt 设为false 如何写 TDAtabase.onLoging 事件的代码中提供有关登录参数?
- 汇编语言能被反编译成DELPHI程序吗?
- 如何让可拖动的Panel在一开始就显示出带关闭按钮的小条?100分伺候!
- 100分急求StrToFloat(edit1.text)用法,急!急1急!急!!!!!!!!!
- 请问怎样知道Mediaplay控件是或处于播放状态
- wep_system_exit和wep_free_dll为什么都说没有定义(关于dll卸载)
- 请教UrlDownloadToFile同时下多个文件问题
- 怎样判定11个TCheckBox组件中,哪个是最后选中的?
- 高手,高分请赶快来这里!
- 用 table1 一连就要身份和 密码,是不是我bde设置不对paradox和access一样么?
例: dbgrid第一列对应query1中的字段'dd'
在dbgridclick事件中写如下:
for j:=1 to 6 do
begin
str:=stringgrid1.Cells[j,i];
stringgrid1.Canvas.Brush.Color:=clwhite;
rect:=stringgrid1.CellRect(j,i);
stringgrid1.Canvas.FillRect(rect);
stringgrid1.Canvas.Font.Color:=cldefault;
stringgrid1.Canvas.TextRect(rect,rect.Left,rect.Top,str);
end;
for i:=0 to stringgrid.rows do
begin
if stringgrid.cells[0,i]=query1.fieldbyanme('dd').asstring then
begin
for i:=1 to 6 do
begin
str:=stringgrid1.Cells[i,stringgrid1.Row];
stringgrid1.Canvas.Brush.Color:=cllime;
rect:=stringgrid1.CellRect(i,stringgrid1.Row);
stringgrid1.Canvas.FillRect(rect);
stringgrid1.Canvas.Font.Color:=cldefault;
stringgrid1.Canvas.TextRect(rect,rect.Left,rect.Top,str);
end;
end;
我是单击dbgrid使得stringgrid的某行加亮显示啊
for i:=1 to stringgrid1.rowcount do
begin
if stringgrid1.cells[0,i]=Query1.fieldbyname('dd').asstring then
begin
k:=i;
break;
end;
end;
for i:=1 to k do
begin
for j:=1 to 6 do
begin
str:=stringgrid1.Cells[j,i];
stringgrid1.Canvas.Brush.Color:=clwhite;
rect:=stringgrid1.CellRect(j,i);
stringgrid1.Canvas.FillRect(rect);
stringgrid1.Canvas.Font.Color:=cldefault;
stringgrid1.Canvas.TextRect(rect,rect.Left,rect.Top,str);
end;
end;
for i:=1 to 6 do //6为stringgrid1的列数
begin
str:=stringgrid1.Cells[i,k];
stringgrid1.Canvas.Brush.Color:=cllime;
rect:=stringgrid1.CellRect(i,k);
stringgrid1.Canvas.FillRect(rect);
stringgrid1.Canvas.Font.Color:=cldefault;
stringgrid1.Canvas.TextRect(rect,rect.Left,rect.Top,str); end;