Autor Beitrag
juelin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 40

Win XP, Linux
D7 K3
BeitragVerfasst: So 30.10.11 16:04 
Hallo,
ich möchte auf einer ListBox zeichen.
Ich habe folgende Befehle im Programm:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
  ListBox1.Canvas.Pen.Color:=clBlack;
  ListBox1.Canvas.Pen.Mode:=pmCopy;
  ListBox1.Canvas.Pen.Style:=psSolid;
  ListBox1.Canvas.Pen.Width:=1;
  ListBox1.Canvas.MoveTo(100,100);
  ListBox1.Canvas.LineTo(800100);
  ListBox1.Canvas.Rectangle(200200800300);
  ListBox1.Canvas.FillRect(Rect(250,220,750,280));
Aber es kommt nix raus.
Was mache ich falsch?

Gruß
Jürgen

Moderiert von user profile iconNarses: Delphi-Tags hinzugefügt
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: So 30.10.11 21:37 
In welchem Ereignis zeichnest du denn und was willst du da zeichnen? Deine Informationen sind mehr als spärlich.
juelin Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 40

Win XP, Linux
D7 K3
BeitragVerfasst: So 30.10.11 22:38 
user profile iconLuckie hat folgendes geschrieben Zum zitierten Posting springen:
In welchem Ereignis zeichnest du denn und was willst du da zeichnen? Deine Informationen sind mehr als spärlich.

Eigentlich bei keinem Ereignis.
In dem Fall: OnActivate des Form
bummi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1248
Erhaltene Danke: 187

XP - Server 2008R2
D2 - Delphi XE
BeitragVerfasst: So 30.10.11 23:29 
Eine Listbox ist keine Paintbox, wenn Du das was Zeichnen willst musst Du den Style auf eine der Ownerdrawns ... setzen und Dich in OnDrawItem gegf. auch ins OnMeasureItem einhängen ...

_________________
Das Problem liegt üblicherweise zwischen den Ohren H₂♂
DRY DRY KISS
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19272
Erhaltene Danke: 1740

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mo 31.10.11 02:54 
user profile iconjuelin hat folgendes geschrieben Zum zitierten Posting springen:
Eigentlich bei keinem Ereignis.
In dem Fall: OnActivate des Form
OnActivate wird ausgeführt, wenn das Fenster aktiviert wird. Danach wird es aber ggf. neu gezeichnet. Deshalb ist deine Zeichnung schlicht sofort wieder weg. Und da du diese nicht bei Bedarf (nämlich im korrekten Ereignis, OnDrawItem wurde ja z.B. schon genannt) erneut zeichnest, siehst du eben nichts davon.