Image Global/Constanten Check

Anfängerfragen zum Programmieren mit PureBasic.
Benutzeravatar
Velindos
Beiträge: 598
Registriert: 15.11.2010 10:56

Image Global/Constanten Check

Beitrag 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!
Windows 7/8/8.1/10 (32/64-Bit) |Ubuntu 10.4 (64-Bit) |Purebasic 5.71 LTS (32/64-Bit)
Benutzeravatar
STARGÅTE
Kommando SG1
Beiträge: 6999
Registriert: 01.11.2005 13:34
Wohnort: Glienicke
Kontaktdaten:

Re: Image Global/Constanten Check

Beitrag 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))
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Aktuelles Projekt: Lizard - Skriptsprache für symbolische Berechnungen und mehr
Benutzeravatar
Velindos
Beiträge: 598
Registriert: 15.11.2010 10:56

Re: Image Global/Constanten Check

Beitrag von Velindos »

Hallo STARGÅTE,
DANKE für deine prompte Unterstützung!
Gruss ... Velindos!
Windows 7/8/8.1/10 (32/64-Bit) |Ubuntu 10.4 (64-Bit) |Purebasic 5.71 LTS (32/64-Bit)
Antworten