PDA

توجه ! این یک نسخه آرشیو شده می باشد و در این حالت شما عکسی را مشاهده نمی کنید برای مشاهده کامل متن و عکسها بر روی لینک مقابل کلیک کنید : زوج فرد شدن رنگ سطرهای يک دبي گريد



TAHA
10-01-2009, 05:00 PM
کد:


procedure TForm1.DBGrid_Professional1DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
var
test1: Real;
RowNo: Integer;
BColor:Tcolor;
begin
with (Sender as TDBGrid) do
begin
if (gdSelected in State) then
begin
// color of the focused row
Canvas.Brush.Color := clblue;
end
else
begin
// get the actual row number
rowno := DataSource1.DataSet.RecNo;
// odd or even ?
test1 := (RowNo / 2) - trunc(RowNo / 2);
// If it's an even one...
if test1 = 0 then
begin
BColor := clWhite
end
// ...else it's an odd one
else
begin
BColor := clYellow;
end;
Canvas.Brush.Color := BColor;
// font color always black
Canvas.Font.Color := clBlack;
end;
Canvas.FillRect(Rect);
// manualy output the text
Canvas.TextOut(Rect.Left + 2, Rect.Top + 1, Column.Field.AsString);
end
end;



__________________
به امید فردا ، شاید فردا روز بهتری باشد