Einzelnen Beitrag anzeigen

Benutzerbild von jim_raynor
jim_raynor

Registriert seit: 17. Okt 2004
Ort: Berlin
1.251 Beiträge
 
Delphi 5 Standard
 
#2

Re: Problem: ComboBox, DrawItem, Canvas

  Alt 11. Mai 2006, 21:26
Du solltest am Anfang ein ComboBox1.Canvas.FillRect machen mit dem original Rect.

Delphi-Quellcode:
procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer;
  Rect: TRect; State: TOwnerDrawState);
begin
  ComboBox1.Canvas.FillRect(Rect);
  Rect.Right := Rect.Left + 16;
  ComboBox1.Canvas.TextOut(Rect.Right+2, Rect.Top+2, IntToStr(Index));
  if Index mod 2 = 0 then
    ComboBox1.Canvas.Brush.Color := clBlue
  else
    ComboBox1.Canvas.Brush.Color := clRed;
  ComboBox1.Canvas.FillRect(Rect);
end;
damit das ganze Item gesäubert wird
Christian Reich
Schaut euch mein X-COM Remake X-Force: Fight For Destiny ( http://www.xforce-online.de ) an.
  Mit Zitat antworten Zitat