Autor Beitrag
Regan
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2157
Erhaltene Danke: 72


Java (Eclipse), Python (Sublimetext 3)
BeitragVerfasst: Mi 31.05.06 20:14 
Hallo,

ich möchte einen ICO Maker programmieren. Dabei soll man einen bestimmten bereich (max 32x32) markieren und das wird dann in einer anderen image componente angezeigt. jetzt ist aber das problem, dass wenn ich die zweite image componente als ico speichern will, kommt, dass das kein ico bild sei.

wie kann ich nun der image komponente beibringen, dass das ein ICON ist?
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Mi 31.05.06 20:20 
DrawIcon(Image1.Canvas.handle, 0, 0, LoadImage(0, 'C:\icon.ico', IMAGE_ICON, 0, 0, LR_LOADFROMFILE));

vl hilft das!!!

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Mi 31.05.06 20:22 
aber eher das oder??

Diese Funktion erstellt ein Icon aus einer Bitmap.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
function CreateIconFromBmp(Bmp: TBitmap): TIcon;
begin
  with TImageList.CreateSize(Bmp.Width, Bmp.Height) do
  try
    {$IFDEF VER90}
    with Bmp do AddMasked(Bmp, Canvas.Pixels[Width-1, Height-1]);
    {$ELSE}
    AddMasked(Bmp, Bmp.TransparentColor);
    {$ENDIF}
    Result := TIcon.Create;
    GetIcon(0, Result);
  finally
    Free;
  end;
end;

Aufgerufen werden kann die Funktion Beispielsweise so:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.Button1Click(Sender: TObject);
begin
  Application.Icon:=CreateIconFromBmp(Bitbtn1.Glyph);
end;

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
Regan Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2157
Erhaltene Danke: 72


Java (Eclipse), Python (Sublimetext 3)
BeitragVerfasst: Mi 31.05.06 20:27 
das funktioniert irgendwie nich... da hängt sich delphi auf und ich muss es beenden.
Born-to-Frag
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1094

Win XP SP2, Win 2000 SP4
Delphi 7, 2k5
BeitragVerfasst: Mi 31.05.06 20:29 
user profile iconRegan hat folgendes geschrieben:
das funktioniert irgendwie nich... da hängt sich delphi auf und ich muss es beenden.


Delphi hängt sich auf? :shock:

_________________
Theorie ist wenn man alles weiß, aber nichts funktioniert. Praxis ist wenn alles funktioniert, aber niemand weiß warum.
Microsoft vereint Theorie und Praxis: Nichts funktioniert und niemand weiß warum.
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Mi 31.05.06 20:29 
beim 2ten??

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
Regan Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2157
Erhaltene Danke: 72


Java (Eclipse), Python (Sublimetext 3)
BeitragVerfasst: Mi 31.05.06 20:34 
beim ersten passiert gar nichts und beim zweiten hängt er sich auf. ich hab aber grad festgestellt, dass da markieren und einfügen nich geht. da muss ich wohl noch mal ne weile sitzen.
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Mi 31.05.06 20:36 
zu meiner verteidigung ich habs 1 zu eins von einer seite übernommen:
www.dsdt.info/

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
Regan Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2157
Erhaltene Danke: 72


Java (Eclipse), Python (Sublimetext 3)
BeitragVerfasst: Mi 31.05.06 20:39 
hmm... naja ich guck ma was ich machen kann...
Regan Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2157
Erhaltene Danke: 72


Java (Eclipse), Python (Sublimetext 3)
BeitragVerfasst: Mi 31.05.06 21:20 
es funzt alles so gut bis ich das ganze als ico speichern will. dann sagt er mir, dass es nich geht. was muss ich machen?
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Do 01.06.06 11:36 
warst du schon auf der Seite und hast dir den Kompletten beitrag angesehen???

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
Regan Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2157
Erhaltene Danke: 72


Java (Eclipse), Python (Sublimetext 3)
BeitragVerfasst: Do 01.06.06 16:27 
welchen beitrag? ich hab mir nur das angeguckt was du hier eingefügt hast. und dort hab ich auch ne schleife gefunden, die das ganze von ico in bmp macht. aber anderes herum geht nich weil ne ico komponente nich canvas hat.
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Fr 02.06.06 09:12 
na dann : kuck mal auf die seite: www.dsdt.info/tipps/?id=332

mfg el

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
Fighter#1
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 787

Win XP, Ubuntu 8.04
Turbo Delphi 2006, Delphi 2005 Pe, Delphi 5 Pe, Netbeans 6.1, Eclipse, Microsoft VisualC#, Dev C++, PHP, HTML, CSS
BeitragVerfasst: Fr 02.06.06 09:20 
Ich habs auch mal mit dem Code gelöst,
in etwa so:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
var Icon:TIcon;
begin
Icon:=CreateIconFromBmp(Image1.Picture.Bitmap);
Icon.SaveToFile(InputBox('IconCreator','Bitte Dateiname und Pfad angeben, wo gespeichert werden soll','C:\Icon.ico'));
end;

_________________
Wer andere beherrscht ist stark,
wer sich selbst beherrscht ist mächtig. Lao Tse
elundril
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 3747
Erhaltene Danke: 123

Windows Vista, Ubuntu
Delphi 7 PE "Codename: Aurora", Eclipse Ganymede
BeitragVerfasst: Fr 02.06.06 09:21 
gut gemacht!! viel kürzer!! hast meinen respekt!!

_________________
This Signature-Space is intentionally left blank.
Bei Beschwerden, bitte den Beschwerdebutton (gekennzeichnet mit PN) verwenden.
Fighter#1
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 787

Win XP, Ubuntu 8.04
Turbo Delphi 2006, Delphi 2005 Pe, Delphi 5 Pe, Netbeans 6.1, Eclipse, Microsoft VisualC#, Dev C++, PHP, HTML, CSS
BeitragVerfasst: Fr 02.06.06 09:59 
Bitte keine Übertriebene Euphorie.
Der Code funktioniert nur mit der Einschränkung das es nur mit Bitmaps funzt,
ich schreib dir noch de Procedure Jpeg2Bmp.
MfG Fighter#1

_________________
Wer andere beherrscht ist stark,
wer sich selbst beherrscht ist mächtig. Lao Tse
Fighter#1
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 787

Win XP, Ubuntu 8.04
Turbo Delphi 2006, Delphi 2005 Pe, Delphi 5 Pe, Netbeans 6.1, Eclipse, Microsoft VisualC#, Dev C++, PHP, HTML, CSS
BeitragVerfasst: Fr 02.06.06 11:25 
Also,
mit der Procedure lade ich ein Bild, egal ob jpeg oder bitmap.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
var endung:String;
jpeg:TJPegImage;
bitmap:Tbitmap;
begin
jpeg:=TJpegimage.Create;

      If OpenDialog1.Execute
      THen Image1.Picture.LoadFromFile(OpenDialog1.Filename);

Endung:=Copy(OpenDialog1.Filename,Pos('.',OpenDialog1.Filename),Length(OpenDialog1.Filename));
Endung:=LowerCase(Endung);

   If (Endung='.jpg'Or (Endung='.jpeg'Then begin

bitmap:=TBitmap.Create;
jpeg.LoadFromFile(OpenDialog1.Filename);
bitmap.Assign(jpeg);
image1.Picture.Bitmap:=bitmap;

   end;


Wenn du willst kann ich meinen Iconer Source mal posten

_________________
Wer andere beherrscht ist stark,
wer sich selbst beherrscht ist mächtig. Lao Tse
Regan Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2157
Erhaltene Danke: 72


Java (Eclipse), Python (Sublimetext 3)
BeitragVerfasst: Fr 02.06.06 21:22 
also der erste teil funktioniert sehr gut. vielen dank. aber da gäb es noch ein problem:

user profile iconFighter#1 hat folgendes geschrieben:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
var Icon:TIcon;
begin
Icon:=CreateIconFromBmp(Image1.Picture.Bitmap);
Icon.SaveToFile(InputBox('IconCreator','Bitte Dateiname und Pfad angeben, wo gespeichert werden soll','C:\Icon.ico'));
end;

Der teil funzt ne. muss ich vielleicht noch was in der uses liste hinzufügen? ich benutze eine VCL Anwendung.
Fighter#1
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 787

Win XP, Ubuntu 8.04
Turbo Delphi 2006, Delphi 2005 Pe, Delphi 5 Pe, Netbeans 6.1, Eclipse, Microsoft VisualC#, Dev C++, PHP, HTML, CSS
BeitragVerfasst: Sa 03.06.06 13:11 
OOPs,
ich hab einfach nur die Funktion umbenannt.
Einfach den normalen Funktionsnamen eingeben und alles ist wieder im lot
:lol:

_________________
Wer andere beherrscht ist stark,
wer sich selbst beherrscht ist mächtig. Lao Tse
Regan Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2157
Erhaltene Danke: 72


Java (Eclipse), Python (Sublimetext 3)
BeitragVerfasst: Sa 03.06.06 13:35 
?? welchen normalen funktionsnamen?