H heming Unregistered / Unconfirmed GUEST, unregistred user! 2002-08-21 #1 1、如何取得选定行的单元格数据? 2、如何使不同的表格行显示不同的颜色? 使用StringGrid1.Canvas.Font.Color := clRed;没有反应
W wolfsong Unregistered / Unconfirmed GUEST, unregistred user! 2002-08-21 #2 procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); begin With StringGrid1.Canvas do begin If (ARow= 2) then begin Brush.Color := ClBlue; FillRect(Rect); end; end; end;
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); begin With StringGrid1.Canvas do begin If (ARow= 2) then begin Brush.Color := ClBlue; FillRect(Rect); end; end; end;
张 张剑波 Unregistered / Unconfirmed GUEST, unregistred user! 2002-08-21 #4 1、如何取得选定行的单元格数据? xx:=stringgrid1.cells[stringgrid1.Selection.Left,stringgrid1.Selection.top];
H heming Unregistered / Unconfirmed GUEST, unregistred user! 2002-08-21 #5 这只能得到所选择的表格行最左边单元格数据,需要其他单元格数据呢??
冷 冷叶风 Unregistered / Unconfirmed GUEST, unregistred user! 2002-08-21 #8 wolfsong,已经解决了, 只是需要重画一下表格里的内容而已! DrawText不就可以了,当然要设pen了!
L linsb Unregistered / Unconfirmed GUEST, unregistred user! 2002-08-22 #9 procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); var dx, dy, i: byte; begin if (arowl = 4) and not (acol = 0) then with stringgrid1 do begin canvas.Brush.color := clYellow; canvas.FillRect(Rect); canvas.font.color := clblue; dx := 2; //调整此值,控制字在网格中显示的水平位置 dy := 2; //调整此值,控制字在网格中显示的垂直位置 canvas.TextOut(rect.left + dx, rect.top + dy, cells[acol, arow]); end; end;
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); var dx, dy, i: byte; begin if (arowl = 4) and not (acol = 0) then with stringgrid1 do begin canvas.Brush.color := clYellow; canvas.FillRect(Rect); canvas.font.color := clblue; dx := 2; //调整此值,控制字在网格中显示的水平位置 dy := 2; //调整此值,控制字在网格中显示的垂直位置 canvas.TextOut(rect.left + dx, rect.top + dy, cells[acol, arow]); end; end;