Mega Code Archive

 
Categories / Delphi / VCL
 

Comboboxda ki texti saga dayali göstermek

//1. Property Style = csOwnerDrawVariable yada csOwnerDrawFixed //2. Ereignis DrawItem //Örnek; procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); var S: String; iLeft, w : Integer; begin S := ComboBox1.Items[Index]; w := ComboBox1.Canvas.TextWidth(S); if w > (Rect.right - Rect.Left - 2) then iLeft := Rect.Left + 2 else iLeft := (Rect.right - w) - 2; ComboBox1.Canvas.FillRect(Rect); ComboBox1.Canvas.TextOut(iLeft, Rect.Top, S); end; //Sevgilerimle NC nihat@cikrak.de