delphi4arab منتديات دلفي للعرب
تلوين كلمة داخل StringGrid - نسخة قابلة للطباعة

+- delphi4arab منتديات دلفي للعرب (https://delphi4arab.net/forum)
+-- قسم : منتديات دلفي للعرب التعليمية (https://delphi4arab.net/forum/forumdisplay.php?fid=3)
+--- قسم : سؤال و جواب حول دلفي (https://delphi4arab.net/forum/forumdisplay.php?fid=15)
+--- الموضوع : تلوين كلمة داخل StringGrid (/showthread.php?tid=964)



تلوين كلمة داخل StringGrid - نورالمغاربية - 15-06-2009

السلام عليكم

stringgrid في الدلفي
كيف أغير لون كلمة فيها ؟
شكرا


تلوين كلمة داخل StringGrid - me_delphi - 15-06-2009

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