Italia
Fonte/ Codesnippets

Anzeigegröße Bildgröße Proportional Prüfen Umrechnen

 

Michael
Dell
Sind CX > MaxX und/oder CY > MaxY dann wird Proportional
auf Monitorgröße umgerechnet! (XProfan10)

Proc gCkSize

    Parameters gCS_CX&,gCS_CY&,gCS_MaxX&,gCS_MaxY&
    Declare gCS_EX&,gCS_EY&
    Clear gCS_EX&,gCS_EY&
    gCS_EX& = gCS_CX&
    gCS_EY& = gCS_CY&

    If (gCS_CY& > gCS_MaxY&)

        gCS_EY& = gCS_MaxY&
        gCS_EX& = (gCS_CX& * (gCS_EY& / gCS_CY&))

    EndIf

    If (gCS_EX& > gCS_MaxX&)

        gCS_EX& = gCS_MaxX&
        gCS_EY& = (gCS_EY& * (gCS_EX& / gCS_CX&))

    EndIf

    Gl_CX& = gCS_EX&
    Gl_CY& = gCS_EY&
    Return 0

EndProc

Demo:
Declare Gl_CX&,Gl_CY&

Proc ChkDat

    Parameters CD_dName$
    CD_dName$ = Upper$(CD_dName$)
    CaseNot FileExists(CD_dName$): Return 0
    Case InStr(".BMP",CD_dName$) : Return 1
    Case InStr(".GIF",CD_dName$) : Return 1
    Case InStr(".JPG",CD_dName$) : Return 1
    Case InStr(".JPEG",CD_dName$): Return 1
    Case InStr(".PNG",CD_dName$) : Return 1   ab XProfan11
    Return 0

EndProc

Proc DelPHndl

    Parameters DO_PHndl&
    Case DO_PHndl&: DeleteObject DO_PHndl&
    Return 0

EndProc

Proc cPic

    Parameters cP_PHndl&,cP_dNr&
    Declare cP_Name$
    cP_Name$ = ListBoxItem$(cP_dNr&)

    If ChkDat(cP_Name$)

        cP_PHndl&  = DelPHndl(cP_PHndl&)
        cP_PHndl&  = Create("HPic",-1,cP_Name$)
        gCkSize(%BmpX,%BmpY,%MaxX,%MaxY)      Sind %BmpX > %MaxX und/oder %BmpY > %MaxY dann Proportional
        auf Monitorgröße umrechnen!
        DrawSizedPic cP_PHndl&,0,0-Gl_CX&,Gl_CY&;0

    Else

        Return 0

    EndIf

    Return cP_PHndl&

EndProc

Proc gCkSize

    Parameters gCS_CX&,gCS_CY&,gCS_MaxX&,gCS_MaxY&
    Declare gCS_EX&,gCS_EY&
    Clear gCS_EX&,gCS_EY&
    gCS_EX& = gCS_CX&
    gCS_EY& = gCS_CY&

    If (gCS_CY& > gCS_MaxY&)

        gCS_EY& = gCS_MaxY&
        gCS_EX& = (gCS_CX& * (gCS_EY& / gCS_CY&))

    EndIf

    If (gCS_EX& > gCS_MaxX&)

        gCS_EX& = gCS_MaxX&
        gCS_EY& = (gCS_EY& * (gCS_EX& / gCS_CX&))

    EndIf

    Gl_CX& = gCS_EX&
    Gl_CY& = gCS_EY&
    Return 0

EndProc

Declare Gl_PHndl&,Gl_dName$,Gl_PMaxNr&,Gl_Zaehler&
TextColor RGB(255,255,255),0
WindowStyle $F0
Window 0,0-%MaxX,%MaxY
ShowCursor 0
Cls 0
TextColor RGB(255,255,255),0
ClearList
AddFiles *"*.BMP"
AddFiles *"*.GIF"
AddFiles *"*.JPG"
AddFiles *"*.PNG"   ab XProfan11
Gl_PMaxNr& = %GetCount
Case (Gl_PMaxNr& = -1): End
Def CckVGK(1) If((&(1) > Gl_PMaxNr&),0,If((&(1) < 0),Gl_PMaxNr&,&(1)))
Gl_PHndl&   = cPic(Gl_PHndl&,0)
Gl_Zaehler& = 0
Gl_PHndl& = cPic(Gl_PHndl&,Gl_Zaehler&)

While 1: WaitInput : Cls 0

    Case (IsKey(27) | IsKey(69) | IsKey(101) | IsKey(4)): Break

    If (IsKey(34) | IsKey(37) | IsKey(40) | IsKey(2))

        Dec Gl_Zaehler&

    Else

        Inc Gl_Zaehler&

    EndIf

    Gl_Zaehler& = CckVGK(Gl_Zaehler&)
    Gl_PHndl& = cPic(Gl_PHndl&,Gl_Zaehler&)

EndWhile

ShowCursor 1
ClearList
DelPHndl(Gl_PHndl&)
End
Geht mit Create("hSizedPic",...) einfacher aber man sieht hier wies geht.
 
Salu Michael...

Hab zwar krumme Fieß awer dofir e' ecklich Gsicht! 
04.08.2008  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

Kein Systemprofil angelegt. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Bitte anmelden um einen Beitrag zu verfassen.
 

Topic-Options

7.126 Views

Untitledvor 0 min.
Michael Hettner02.05.2022
Jörg Sellmeyer28.05.2020
GDL12.09.2015
Dieter Zornow18.11.2011
Di più...

Themeninformationen

Dieses Thema hat 1 subscriber:

Michael Dell (1x)


Admins  |  AGB  |  Applications  |  Autori  |  Chat  |  Informativa sulla privacy  |  Download  |  Entrance  |  Aiuto  |  Merchantportal  |  Impronta  |  Mart  |  Interfaces  |  SDK  |  Services  |  Giochi  |  Cerca  |  Support

Ein Projekt aller XProfaner, die es gibt!


Il mio XProfan
Private Notizie
Eigenes Ablageforum
Argomenti-Merkliste
Eigene Beiträge
Eigene Argomenti
Zwischenablage
Annullare
 Deutsch English Français Español Italia
Traduzioni

Informativa sulla privacy


Wir verwenden Cookies nur als Session-Cookies wegen der technischen Notwendigkeit und bei uns gibt es keine Cookies von Drittanbietern.

Wenn du hier auf unsere Webseite klickst oder navigierst, stimmst du unserer Erfassung von Informationen in unseren Cookies auf XProfan.Net zu.

Weitere Informationen zu unseren Cookies und dazu, wie du die Kontrolle darüber behältst, findest du in unserer nachfolgenden Datenschutzerklärung.


einverstandenDatenschutzerklärung
Ich möchte keinen Cookie