Seite 1 von 1

Image Global/Constanten Check

Verfasst: 06.02.2020 12:30
von Velindos
Hallo Leute,
stehe gerad auf der Leitung. Warum geht Image mit Constante und NICHT mit Global?

BILD auf CONSTANTEN Checken

Code: Alles auswählen

EnableExplicit

UsePNGImageDecoder()

Enumeration
  #Img_Lander
EndEnumeration

#WndX = 400
#WndY = 266

Global Img_Lander
Img_Lander = CatchImage(#Img_Lander,?Img_Lander)
ResizeImage(#Img_Lander,#WndX, #WndY,#PB_Image_Smooth)

DataSection
  Img_Lander:
  IncludeBinary "D:\[Pure@API]\[STORE]\png\MarsLander.png" ; <================= BILD
EndDataSection

Global Flags = #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget
OpenWindow(0, 100, 200, #WndX, #WndY, "Imgae Constanten Check", Flags )
ImageGadget(1,0,0,#WndX,#WndY,ImageID(#Img_Lander))

Define Event, Quit
Repeat
  Event = WaitWindowEvent()
  If Event = #PB_Event_CloseWindow  ; If the user has pressed on the close button
    Quit = 1
  EndIf
  
Until Quit = 1
BILD auf GLOBAL Checken

Code: Alles auswählen

EnableExplicit

UsePNGImageDecoder()

#WndX = 400
#WndY = 266

Global Img_Lander
Img_Lander = CatchImage(#PB_Any,?Img_Lander)

DataSection
  Img_Lander:
  IncludeBinary "D:\[Pure@API]\[STORE]\png\MarsLander.png"
EndDataSection

ResizeImage(Img_Lander, #WndX, #WndY,#PB_Image_Smooth)

Global Flags = #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget
OpenWindow(0, 100, 200, #WndX, #WndY, "Image Global Check", Flags )
ImageGadget(1,0,0,#WndX, #WndY,Img_Lander)

Define Event, Quit
Repeat
  Event = WaitWindowEvent()
  If Event = #PB_Event_CloseWindow  ; If the user has pressed on the close button
    Quit = 1
  EndIf
  
Until Quit = 1
Gruss ... Velindos!

Re: Image Global/Constanten Check

Verfasst: 06.02.2020 12:34
von STARGÅTE
Auch im "Global"-Fall ist Img_Lander die Image Nummer, nicht die ID!
Also unten:

Code: Alles auswählen

ImageGadget(1,0,0,#WndX, #WndY,ImageID(Img_Lander))

Re: Image Global/Constanten Check

Verfasst: 06.02.2020 12:38
von Velindos
Hallo STARGÅTE,
DANKE für deine prompte Unterstützung!
Gruss ... Velindos!