Zitat von
TheAn00bis:
Etwas so:
Delphi-Quellcode:
procedure TStyle.ComboBox1DrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState);
var Canv: TCanvas;
begin
Canv := TCanvas.create;
Canv.handle := GetWindowDC(0);
InflateRect(Rect, -1, -1);
control.Canv.Pen.color := clRed;
control.Canv.Rectangle(Rect);
end;
nicht ganz, eher so (schließlich willst du ja die canvas von der Combobox und nicht von dem Desktop)
Delphi-Quellcode:
procedure TStyle.ComboBox1DrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState);
var Canv: TCanvas;
begin
Canv := TCanvas.create;
Canv.handle := GetWindowDC(Control.Handle);
Canv.Pen.color := clRed;
Canv.Rectangle(Rect);
ReleaseDC(Control.Handle, Canv.Handle);
Canv.Free;