TImageList->Draw zeigt nichts an
-
huhu,
ich bin jetzt nach stundenlanger verzweifelter google suche hier gelandet. sollte ich etwas übersehen haben wäre ich für einen link dankbar
ich möchte folgendes tun:
Ich habe eine ITmageList mit x Bitmaps darin. Diese möchte ich einer Gruppe meiner Form untereinander ausgeben. http://www.functionx.com/bcb/gdi/bitmapdesign/imglist1.gif << wie so nur untereinander.Graphics::TBitmap *Bmp = new Graphics::TBitmap; int x = 0; int y = 0; for(int i = 0; i<ImageList->Count; i++) { ImageList->GetBitmap(i, Bmp); ImageList->Draw(this->Canvas, x,y, i); Application->ProcessMessages(); y = y+150; }
Leider zeigt er überhaupt nichts an. Kann es sein das er nicht weiss wohin er zeichnen soll mit "Canvas" ? (die bilder in der liste existieren, ich kann sie direkt einem TImage zuweisen, aber das wär ja nur eins, und nicht alle untereinander)
lg leli
-
Hallo
Also ich sehe jetzt in deinem Codeausszug keinen konkreten Fehler. Wo wird dieser Code ausgeführt? Du must ihn im Paint-Event anwenden.
bis bald
Stefan
-
hi Stefan,
ich führe das in der Hauptroutine der Form aus:
__fastcall TmainView::TmainView(TComponent* Owner) : TForm(Owner) { ImageList->Width=100; ImageList->Height=150; Graphics::TBitmap * bmpPicture = NULL; //grafik 1 bmpPicture = new Graphics::TBitmap; bmpPicture->LoadFromFile(L"D:\\masks\\thumbs\\tmpmask_thumb.bmp"); ImageList->Add(bmpPicture,bmpPicture); //grafik 2 bmpPicture = new Graphics::TBitmap; bmpPicture->LoadFromFile(L"D:\\masks\\thumbs\\grey.bmp"); ImageList->Add(bmpPicture,bmpPicture); Graphics::TBitmap *Bmp = new Graphics::TBitmap; int x = 0; int y = 0; for(int i = 0; i<ImageList->Count; i++) { ImageList->GetBitmap(i, Bmp); // So Funktionierts mit 1 bild // Image4->Picture->Bitmap = Bmp; // Image4->Canvas-Refresh(); //Hier passiert nichts ImageList->Draw(this->Canvas, x,y, i); Application->ProcessMessages(); y = y+150; } Image1->Canvas->Refresh(); Image2->Canvas->Refresh(); }
ich hab so das gefühl das ich Canvas irgendwie genauer bestimmen müsste weil ich viele verschiedene boxen in der form habe.
-
Hallo
Und dort ist es auch nutzlos. Du must die Zeichenoperation in den OnPaint-Event verschieben
bis bald
akari
-
heureka :> es funktioniert! tausend dank!