![]() |
|
|||
|
string grid'de herhangibir colonun yada row un text'inin rengini nasıl değiştiriyoruz?mesela 1.colonun 1.rowundaki yazının rengini değiştirmek istiyorum bunu nasıl yapabilirim yardımcı olursanız sevinirim.
stringgrid1.canvas.brush.color:=clred; komutundan baska bi komut yokmu cunki bu yapmıyor
|
|
|||
|
Merhaba
Aşağıdaki koda bir bakın (Usenet'de bir delphi grubundan buldum, denedim çalışıyor. Bir form hazırlayıp içine bir string grid koyup stringgrid'in ondrawcwell hadisesine atamanız lazım StringGrid1DrawCell isimli prosedürü) : unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Grids; type TForm1 = class(TForm) Button1: TButton; StringGrid1: TStringGrid; procedure StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Longint; Rect: TRect; State: TGridDrawState); var OldColor : TColor; OldBrush : TBrush; begin with StringGrid1.Canvas do begin OldColor := Font.Color; OldBrush := Brush; {paint fridays} if StringGrid1.Cells[ACol,1] = 'Fr' then begin Brush.Color := $02aaaaaa; {light gray} FillRect(Rect); Font.Color := clWhite; TextOut(Rect.Left+2,Rect.Top+2,StringGrid1.Cells[ACol,ARow]); end; {paint each alternating month} if (ARow = 0) and (ACol > 0) then begin if (Odd(StrToIntDef(StringGrid1.Cells[ACol,31],0))) then Brush.Color := clBlue else Brush.Color := clFuchsia; FillRect(Rect); Font.Color := clWhite; TextOut(Rect.Left+2,Rect.Top+2,StringGrid1.Cells[ACol,ARow]); end; {paint days of the week} if (ARow = 1) and (ACol > 0) then begin if StringGrid1.Cells[ACol,1] = 'Fr' then Brush.Color := clTeal else Brush.Color := clAqua; FillRect(Rect); if StringGrid1.Cells[ACol,1] = 'Fr' then Font.Color := clWhite else Font.Color := clBlack; TextOut(Rect.Left+2,Rect.Top+2,StringGrid1.Cells[ACol,ARow]); end; Font.Color := OldColor; Brush := OldBrush; end; end; end. |
|
|||
|
Merhaba
Misali usenet'ten buldum diye yazmışım dalgınlıkla, usenet'e de bakmaya çalışmıştım misal için. Doğrusu internet'ten arama ile bulmuştum, sitenin adresi de şöyle (başka güzel misaller de var orada) : http://www.csd.net/~cgadd/knowbase/DELPHI.htm |
![]() |
| Seçenekler | |
| Stil | |
|
|
Benzer Konular
|
||||
| Konu | Konuyu Başlatan | Forum | Cevaplar | Son Mesaj |
| iyinet.com tracker yeni versiyonu grid i destekliyor | iyinet | Forumda | 1 | 2004-09-28 12:56 |
| String grid sorusu | scokpinar | Java JSP C# | 0 | 2004-07-21 14:14 |
| string kontrolü | asilter | PHP | 2 | 2004-01-14 21:13 |
| String işlemleri | granit | Java JSP C# | 1 | 2002-12-28 21:01 |
| string grid | Anonymous | PHP | 0 | 2002-07-08 20:47 |