hab mal versucht nen IconCreator zu basteln, müsste normalerweise im Großen und Ganzen gehen, tut er aber nicht; hab irgendwo den Wurm drin.
Code: Alles auswählen
;#####################
;# #
;# IconCreator XXL #
;# #
;#####################
;*****-Fenster-*****
Enumeration
#HauptFenster
EndEnumeration
;*****-Bilder-*****
Enumeration
#AuswahlImage
#OrginalBitmap
#Bitmap
#Icon
EndEnumeration
;*****-Gadgets-*****
Enumeration
#Frame3DGroesse
#Frame3DTransparent
#Frame3DVorschau
#TextColorTransparent
#TextChooseColorTransparent
#Option16
#Option24
#Option32
#Option48
#CheckTransparent
#ColorTransparent
#ChooseColorTransparent
#ImageBitmap
#ButtonSpeichern
#ButtonAbbrechen
EndEnumeration
;*****-Name der Andwendung-*****
#AndwendungName = "IconCreator XXL"
;*****-Varialben, Strings-*****
Global Bitmap$
Global SaveIcon$
;*****-Icon erstellen-*****
Procedure CreateIcon()
If GetGadgetState(#Option16) <> 0
Restore IconHeader_16
ElseIf GetGadgetState(#Option24) <> 0
Restore IconHeader_24
ElseIf GetGadgetState(#Option32) <> 0
Restore IconHeader_32
ElseIf GetGadgetState(#Option48) <> 0
Restore IconHeader_48
EndIf
CreateFile(#Icon, SaveIcon$ + ".ico")
For n = 1 To 62
Read ThisValue
WriteData(#Icon, @ThisValue, 1)
Next n
For ny = 31 To 0 Step -1
For nx = 0 To 31 Step 1
If StartDrawing(ImageOutput(#Bitmap))
Color = Point(nx, ny)
WriteByte(#Icon, Red(Color))
WriteByte(#Icon, Green(Color))
WriteByte(#Icon, Blue(Color))
StopDrawing()
EndIf
Next nx
Next ny
For nm = 1 To 128 ;<<<<<---- Hier weiß ich irgendwie nicht für was das gut sein soll. (Habs in anderen Codes abgeguckt)
WriteByte(#Icon, 0)
Next nm
CloseFile(#Icon)
EndProcedure
;*****-Bitmap öffnen-*****
Bitmap$ = OpenFileRequester("Bitmap öffnen", "", "Bitmap | *.bmp", 0)
If Bitmap$ <> ""
LoadImage(#OrginalBitmap, Bitmap$)
CopyImage(#OrginalBitmap, #Bitmap)
ResizeImage(#Bitmap, 32, 32)
Else
MessageRequester("Fehler", "Bitmap konnte nicht geladen werden!", #MB_ICONERROR)
End
EndIf
;*****-Hauptfenster öffnen-*****
If OpenWindow(#HauptFenster, 0, 0, 330, 290, #AndwendungName, #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
;*****-Gadgetliste-*****
If CreateGadgetList(WindowID(#HauptFenster))
Frame3DGadget(#Frame3DGroesse, 10, 10, 140, 129, "Größe")
OptionGadget(#Option16, 20, 30, 65, 24, "16 x 16")
OptionGadget(#Option24, 20, 55, 65, 24, "24 x 24")
OptionGadget(#Option32, 20, 80, 65, 24, "32 x 32")
OptionGadget(#Option48, 20, 105, 65, 24, "48 x 48")
SetGadgetState(#Option32, 1)
Frame3DGadget(#Frame3DTransparent, 10, 150, 140, 129, "Transparents")
CheckBoxGadget(#CheckTransparent, 20, 170, 120, 24, "Transparentes Icon")
ContainerGadget(#ColorTransparent, 20, 205, 20, 20, #PB_Container_Raised)
SetGadgetColor(#ColorTransparent, #PB_Gadget_BackColor, RGB(255, 255, 255))
CloseGadgetList()
TextGadget(#TextColorTransparent, 50, 200, 70, 30, "Transparente Farbe")
ButtonGadget(#ChooseColorTransparent, 20, 240, 20, 20, "")
TextGadget(#TextChooseColorTransparent, 50, 235, 70, 30, "Transparente Farbe wählen")
Frame3DGadget(#Frame3DVorschau, 170, 10, 150, 180, "Vorschau")
ImageGadget(#ImageBitmap, 190, 40, 0, 0, ImageID(#Bitmap), #PB_Image_Border)
ButtonGadget(#ButtonSpeichern, 180, 209, 130, 30, "Als Icon speichern")
ButtonGadget(#ButtonAbbrechen, 180, 249, 130, 30, "Abbrechen")
EndIf
;*****-Hauptschleife-*****
Repeat
EventID = WaitWindowEvent()
;*****-Gadgetabfrage-*****
If EventID = #PB_Event_Gadget
Select EventGadget()
Case #Option16
FreeImage(#Bitmap)
CopyImage(#OrginalBitmap, #Bitmap)
ResizeImage(#Bitmap, 16, 16)
FreeGadget(#ImageBitmap)
ImageGadget(#ImageBitmap, 190, 40, 0, 0, ImageID(#Bitmap), #PB_Image_Border)
Case #Option24
FreeImage(#Bitmap)
CopyImage(#OrginalBitmap, #Bitmap)
ResizeImage(#Bitmap, 24, 24)
FreeGadget(#ImageBitmap)
ImageGadget(#ImageBitmap, 190, 40, 0, 0, ImageID(#Bitmap), #PB_Image_Border)
Case #Option32
FreeImage(#Bitmap)
CopyImage(#OrginalBitmap, #Bitmap)
ResizeImage(#Bitmap, 32, 32)
FreeGadget(#ImageBitmap)
ImageGadget(#ImageBitmap, 190, 40, 0, 0, ImageID(#Bitmap), #PB_Image_Border)
Case #Option48
FreeImage(#Bitmap)
CopyImage(#OrginalBitmap, #Bitmap)
ResizeImage(#Bitmap, 48, 48)
FreeGadget(#ImageBitmap)
ImageGadget(#ImageBitmap, 190, 40, 0, 0, ImageID(#Bitmap), #PB_Image_Border)
Case #ButtonSpeichern
SaveIcon$ = SaveFileRequester("Icon Speichern als...", "", "Icon | *.ico", 0)
CreateIcon()
Case #ButtonAbbrechen
EventID = 16
EndSelect
EndIf
If GetGadgetState(#CheckTransparent) = 1
DisableGadget(#ChooseColorTransparent, 0)
DisableGadget(#TextChooseColorTransparent, 0)
DisableGadget(#TextColorTransparent, 0)
Else
DisableGadget(#ChooseColorTransparent, 1)
DisableGadget(#TextChooseColorTransparent, 1)
DisableGadget(#TextColorTransparent, 1)
EndIf
Until EventID = #PB_Event_CloseWindow
Else
MessageRequester("Fehler", "Fenster konnte nicht geöffnet werden!", #MB_ICONERROR)
End
EndIf
End
;*****-Iconformate-*****
DataSection
IconHeader_16:
Data.l $00, $00, $01, $00, $01, $00, $10, $10, $00, $00, $01, $00, $08, $00, $68, $05
Data.l $00, $00, $16, $00, $00, $00, $28, $00, $00, $00, $10, $00, $00, $00, $20, $00
Data.l $00, $00, $01, $00, $08, $00, $00, $00, $00, $00, $00, $01, $00, $00, $00, $00
Data.l $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
IconHeader_24:
Data.l $00, $00, $01, $00, $01, $00, $18, $18, $00, $00, $01, $00, $08, $00, $FF, $06
Data.l $00, $00, $16, $00, $00, $00, $28, $00, $00, $00, $18, $00, $00, $00, $30, $00
Data.l $00, $00, $01, $00, $08, $00, $00, $00, $00, $00, $40, $02, $00, $00, $00, $00
Data.l $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
IconHeader_32:
Data.l $00, $00, $01, $00, $01, $00, $20, $20, $00, $00, $01, $00, $08, $00, $FF, $08
Data.l $00, $00, $16, $00, $00, $00, $28, $00, $00, $00, $20, $00, $00, $00, $40, $00
Data.l $00, $00, $01, $00, $08, $00, $00, $00, $00, $00, $00, $04, $00, $00, $00, $00
Data.l $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
IconHeader_48:
Data.l $00, $00, $01, $00, $01, $00, $30, $30, $00, $00, $01, $00, $08, $00, $FF, $0E
Data.l $00, $00, $16, $00, $00, $00, $28, $00, $00, $00, $30, $00, $00, $00, $60, $00
Data.l $00, $00, $01, $00, $08, $00, $00, $00, $00, $00, $00, $09, $00, $00, $00, $00
Data.l $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00
EndDataSection