Autor Beitrag
DelphiNoob
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 152

Win 2003 Server
D7 Ent
BeitragVerfasst: Di 25.03.03 15:03 
Hi,

ich schreibe per Code ein Bitmap in ein ListView. Das klappt auch wunderbar. Nun hab ich aber eine Frage:

Wenn ich den Form Resize, dann ändert sich auch die ListView Größe. Das Bitmap wird immer mittig angezeigt. Nur wenn sich die Größe ändert, dann ändert sich auch die Mitte des ListViews. Wie kann ich nun den Zeichnungsvorgang wiederholen?

Das ganze geschieht wie folgt:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
procedure TForm1.ListView1CustomDraw(Sender: TCustomListView;
  const ARect: TRect; var DefaultDraw: Boolean);
var
Bitmap: TBitmap;
x, y: integer;
begin

Bitmap:=TBitmap.Create;
Bitmap.LoadFromResourceName(HInstance,'ANUBIS');
x:=((ListView1.Height div 2)-(Bitmap.Height div 2));
y:=((ListView1.Width div 2)-(Bitmap.Width div 2));
ListView1.Canvas.Draw(x, y, Bitmap);
Bitmap.Free;

end;


Nur wie kann ich obiges Ereignis beim OnResize nochmal auslösen?

Mfg
DelphiNoob

Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt
ShadowCaster
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 312



BeitragVerfasst: Di 25.03.03 15:16 
ups, Frage falsch verstanden
DelphiNoob Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 152

Win 2003 Server
D7 Ent
BeitragVerfasst: Di 25.03.03 15:33 
Meiner Ansicht nach müsste vieleicht folgendes passieren:

Bei einem Resize müsste das ListView erst wieder "weiss" gezeichnet, und dann direkt danach das Bild neu drauf gesetzt werden.

Nur wie?
Aya
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1964
Erhaltene Danke: 15

MacOSX 10.6.7
Xcode / C++
BeitragVerfasst: Di 25.03.03 16:59 
Hi,

ruf einfach mal im OnResize die Methode "ListView.Refresh" auf... ;)

Au'revoir,
Aya~

_________________
Aya
I aim for my endless dreams and I know they will come true!
DelphiNoob Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 152

Win 2003 Server
D7 Ent
BeitragVerfasst: Di 25.03.03 17:06 
Manche Sachen sind echt zu einfach ;)