Dbgrid ve memo alan

Delphi'de kod yazma ile ilgili sorularınızı bu foruma yazabilirsiniz.
Cevapla
loxka
Üye
Mesajlar: 214
Kayıt: 18 Ağu 2003 01:10

Dbgrid ve memo alan

Mesaj gönderen loxka »

Db Gridin içinde memo alanı gösteren bir kod buldum sitede ama şöyle bir sorunum var gridin bütün alanlarında ve hücrelerinde bu alanı gösteriyor.
bunu nasıl halledebilirim bilmiyorum..

Kod: Tümünü seç

procedure TForm3.DBGrid3DrawColumnCell(Sender: TObject; const Rect: TRect;
  DataCol: Integer; Column: TColumn; State: TGridDrawState);
var 
P: array [0..50] of char; {array size is number of characters needed} 
BS: tBlobStream; {from the memo field} 
S: String; 
begin
if form3.Table1Adres is TMemoField then
begin 
with (Sender as TDBGrid).Canvas do 
begin 
BS:= tBlobStream.Create(TBlobField(form3.Table1Adres), bmRead);
FillChar(P, SizeOf(P), #0); {terminate the null string} 
BS.Read(P, 50); {read 50 chars from memo into blobStream} 
BS.Free; 
S:= StrPas(P); 
while Pos(#13, S) > 0 do 
S[Pos(#13, S)] := ' '; 
while Pos(#10, S) > 0 do 
S[Pos(#10, S)] := ' '; 
FillRect(Rect); {clear the cell} 
TextOut(Rect.Left, Rect.Top, S); {fill cell with memo data} 
end; 
end; 

end; 

Kullanıcı avatarı
m_ekici
Kıdemli Üye
Mesajlar: 563
Kayıt: 11 Haz 2003 06:49
Konum: Adana
İletişim:

Mesaj gönderen m_ekici »

Nasıl hallederimden kastın sadece istediğin kolonda mı çıksın? Eğer bu ise beginde hemen sonra

Kod: Tümünü seç

if DataCol=x Then 
  begin
.
.
.
.
 end 

Cevapla