Autor Beitrag
Hendi48
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 271



BeitragVerfasst: Sa 15.09.07 22:21 
Hi,
also ich habe ein Problem:
Ich habe verschiedene PNGSpeedButton mit PNG Icons. Der Hintergrund von dem Programm (=auf dem die Buttons sind) ist ein TImage mit einem normalen JPEG drin. Wenn man das Programm jetzt startet, haben die Buttons an manchen Stellen einen BtnFace Hintergrund und sind verpixelt. Wenn man den Hintergrund abschaltet (=Form Color -> btnFace), sind die Icons wieder wie im Original.
Kann ich irgendwie machen das sie auch mit Hintergrund so sind?
TProgger
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 148

XP
D6, D2007 prof
BeitragVerfasst: So 16.09.07 09:58 
Eine Lösung wäre, kein TImage als Hintergrund zu nehmen, sondern das Hintergrundbild in bmp umwandeln, in ein über Create erzeugtes TBitmap laden und dieses im OnPaint des Forms mit BitBlt (oder auch StretchBlt) auf den Form-Canvas zu kopieren. Dann sehen die Buttons auch wieder sauber aus.
Hendi48 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 271



BeitragVerfasst: So 16.09.07 15:28 
Kannst du mir ein Beispiel geben? Ich hab bis jetzt das:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
//FormPaint//
var
  bmp: TBitmap;
begin
  bmp := TBitmap.Create;
  bmp.LoadFromFile(apppath+'bckgrnd.bmp');
  BitBlt(
end;

Was muss ich in BitBlt rein tun?
TProgger
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 148

XP
D6, D2007 prof
BeitragVerfasst: So 16.09.07 16:29 
ausblenden Delphi-Quelltext
1:
BitBlt(Canvas.handle, 00, ClientWidth, ClientHeight, bmp.canvas.handle, 00, SRCCOPY);					

oder wenn Du es stretchen musst:
ausblenden Delphi-Quelltext
1:
  StretchBlt(Canvas.handle, 00, ClientWidth, ClientHeight, bmp.canvas.handle, 00, bmp.width, bmp.height SRCCOPY);					
TProgger
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 148

XP
D6, D2007 prof
BeitragVerfasst: So 16.09.07 16:33 
...und noch ein Vorschlag: das bmp nicht in FormPaint erzeugen, sondern nur einmal in FormCreate erzeugen und dort auch nur einmal laden, und in FormDestroy mittels bmp.Free wieder freigeben. FormPaint wird nämlich sehr oft aufgerufen.
Danniolo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 693



BeitragVerfasst: So 16.09.07 16:39 
Hm, das ist komisch - bei mir funktioniert das ganze ohne Probleme. Könntest du vielleicht mal einen Screenshot anhängen?
Einloggen, um Attachments anzusehen!
GericasS
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 540

Windows Vista Home Premium
D2010, VisualStudio2008
BeitragVerfasst: Mo 17.09.07 14:20 
Oh,

das hab ich auch lange versucht, werds heute nachmittag mal versuche und gucken ob der Source bei mir geht !
Hendi48 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 271



BeitragVerfasst: Di 18.09.07 18:11 
Hm, ich hab's mal versucht, das Bild wird aber nicht angezeigt. Was mach ich denn falsch?
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
   FormShow
var
  bmp: TBitmap;
begin
  bmp := TBitmap.Create;
  bmp.LoadFromFile(apppath+'bckgrnd.bmp');
  BitBlt(Canvas.handle, 00, ClientWidth, ClientHeight, bmp.canvas.handle, 00, SRCCOPY);
end;
Danniolo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 693



BeitragVerfasst: Di 18.09.07 18:35 
Warum so 'schwierig'?
Nimm doch einfach ein TImage als Hintergrund.. habe ich auch gemacht und es geht hervorragend..
Hendi48 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 271



BeitragVerfasst: Di 18.09.07 18:37 
Dann tu jetzt noch ein paar TPNGSpeedButtons mit Bildern drin auf dein Bild und kuck wie schön es aussieht..
Danniolo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 693



BeitragVerfasst: Di 18.09.07 18:45 
Jo, also ich finde es sieht toll aus..
Häng doch bitte auch mal einen Screenshot an.
Einloggen, um Attachments anzusehen!
Hendi48 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 271



BeitragVerfasst: Di 18.09.07 21:04 
Ist das Hintergrundbild bei dir auch ein png und sind in den SpeedButtons auch wirlich PNG Bilder? Mein Hintergrund war bisher immer jpeg vielleicht lags daran...
Danniolo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 693



BeitragVerfasst: Di 18.09.07 22:26 
Hab dieselben "Umstände" wie du. JPEG als Hintergrund, PNGs bei den Buttons ;)

Stell am besten mal dein Projekt ein oder wenigstens die Bilder + Screenshot, sodass man es besser nachvollziehen kann.
Achja - welche Erweiterung nutzt du für die PNG-Bilder? Ich benutze diese hier .

mfg
Hendi48 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 271



BeitragVerfasst: Do 20.09.07 11:08 
Ja ich benutze auch die, aber für die SpeedButtons noch die Komponente TPNGSpeedbutton. Wie kann denn nur mit deiner PNG's in SpeedButtons bekommen?

Edit:
Mal ein Bild:
[url=imageshack.us]user defined image[/URL]
TProgger
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 148

XP
D6, D2007 prof
BeitragVerfasst: Do 20.09.07 13:24 
das Package pngImage enthält doch auch einen TPNGButton (befindet sich in der pngextra.pas). Mit dem hatte ich noch nie Probleme.
Danniolo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 693



BeitragVerfasst: Do 20.09.07 15:54 
Eben die benutze ich auch - und wie man sieht funktioniert es bestens. Also, am besten auf die umstellen ;)
Hendi48 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 271



BeitragVerfasst: Do 20.09.07 15:59 
Hm..der gefällt mir nicht. Wenn man auf den mit der Maus über ihn geht hat er diesen alten Delphi 7 Style..ich will den im D2k7 Style..ansonsten ist er gut, das PNG wird richtig angezeigt!
Danniolo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 693



BeitragVerfasst: Do 20.09.07 16:01 
Inwiefern Delphi 7 / Delphi 2007 Style?
Hendi48 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 271



BeitragVerfasst: Do 20.09.07 16:08 
Hier: Das linke ist der schöne D2k7 Style (XP) und der rechte der alte D7 Style (Win98 oder so)
Einloggen, um Attachments anzusehen!
TProgger
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 148

XP
D6, D2007 prof
BeitragVerfasst: Fr 21.09.07 12:41 
Der TPNGButton hat verschiedene Styles, die man im Objectinspector einstellen kann, da kann man auch den FrameBorder (den Rahmen drum rum) abschalten und drei verschiedene PNG-Bilder (Normal, MouseOver, MouseDown) festlegen.