delphi4arab منتديات دلفي للعرب

نسخة كاملة : تلوين كلمة داخل StringGrid
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .

نورالمغاربية

السلام عليكم

stringgrid في الدلفي
كيف أغير لون كلمة فيها ؟
شكرا
PHP كود :
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol,
  
ARow: Integer; Rect: TRect; State: TGridDrawState);
var 
s:string;
begin
    with StringGrid1 
do
begin
if (gdSelected in state)then
         begin
            canvas
.brush.color:=ClWhite;
            
canvas.FillRect(rect);
            
canvas.font.color:=clred;
            
//canvas.font.style:=[fsbold];
            
s:=cells[Acol,ARow];
            
DrawText(Canvas.Handle,PChar(s),StrLen(PChar(s)),Rect,DT_LEFT);
         
end;
end;
end; 

في الحدث OnDrawCell

كما أننا نستطيع جعل النص في منتصف الخلية باستبدال DT_LEFT الى DT_CENTER