Aktuelle Zeit: 24.09.2020 17:47

Alle Zeiten sind UTC + 1 Stunde [ Sommerzeit ]




Ein neues Thema erstellen Auf das Thema antworten  [ 1 Beitrag ] 
Autor Nachricht
 Betreff des Beitrags: Erledigt - Vorschaubild im Tool anzeigen lassen?
BeitragVerfasst: 19.12.2017 03:49 
Offline
Benutzeravatar

Registriert: 20.06.2013 23:27
Hallo,
wenn ich ein Bild per "drag und drop" in mein Tool ziehe wird es übernommen und als Vorschau Bild auch angezeigt.

Nun habe ich aber das ganze zusätzlich so eingestellt, dass ich bei mir folgendes machen kann:
Rechtsklick auf Bild (png, jpg) --> senden an --> Tool.

Das Tool wird dazu in den Ordner: shell:sendto
kopiert, damit es im Windows Kontextmenü unter Senden An erscheint.

Hier wird nun leider das Bild noch nicht als Preview angezeigt, da ich es nicht mit "Drag und Drop" reingezogen habe. Der Pfad zum Bild
wird in das StrinGadget eingetragen und nun möchte ich anhand des Pfades ermitteln wie das dazugehörige Bild zu erkennen ist, damit es statt des Platzhalterbildes angezeigt wird.

Bild

Hat jemand eine Idee wie man das lösen kann?

EDIT:
Erledigt, Code angepasst

Tool ins Kontextmenü, Senden an eingefügt.
Dann auf Bild Rechtsklick - Senden an - Tool gewählt - Ergebnis:

Bild



hier mal ein abgespeckter Code:
Code:
UsePNGImageDecoder()
UseJPEGImageDecoder()

Global Preview.s
Global Files$
Global *Mem
EnableExplicit

Define Event,EventGadget,EventType


Enumeration ;fonts
  #font_mono
EndEnumeration
LoadFont(#font_mono, "Courier New", 10)

Enumeration ;image
  #imgDrop
  #imgAPP
  #imgFile
  #imgTemp
  #pfad
EndEnumeration

;Platzhalter Bild Lupe
CatchImage(#imgDrop, ?droppng_start)

Enumeration ;windows
  #frmMain
 EndEnumeration

Enumeration ;gadgets
  #frmMain_Container
  #frmMain_Image
  #String_FTP_UploadFile
EndEnumeration


Procedure LoadDroppedFile()
  Protected x, y, f.f

  Select UCase(GetExtensionPart(Preview))
    Case "BMP", "PNG", "JPG"
      If LoadImage(#imgTemp, Preview)
        x = ImageWidth(#imgTemp)
        y = ImageHeight(#imgTemp)
        If x > y
          f = y / x
          x = 111
          y = x * f
        ElseIf y > x
          f = x / y
          y = 111
          x = y * f
        Else
          x = 111
          y = 111
        EndIf
        If ResizeImage(#imgTemp, x, y)
          SetGadgetState(#frmMain_Image, 0)
          SetGadgetState(#frmMain_Image, ImageID(#imgTemp))
        EndIf
      EndIf
    Default
      SetGadgetState(#frmMain_Image, ImageID(#imgDrop))
  EndSelect

EndProcedure

Procedure main()
 
  Protected a$ = ProgramParameter(0)
 
  OpenWindow(#frmMain, 0, 0, 180, 240, "", #PB_Window_ScreenCentered|#PB_Window_SystemMenu)
 
  ContainerGadget(#frmMain_Container, 10, 10, 180, 185, #PB_Container_BorderLess)
  ImageGadget(#frmMain_Image, 24, 10, 132, 132, ImageID(#imgDrop))
  TextGadget(#pfad, 5, 135, 50, 20, "Pfad", #Black)
  StringGadget(#String_FTP_UploadFile, 5, 150, 150, 18, "...", #PB_Container_BorderLess)
  CloseGadgetList()
 
  EnableGadgetDrop(#frmMain_Container, #PB_Drop_Files, #PB_Drag_Copy | #PB_Drag_Move)
  EnableGadgetDrop(#frmMain_Image, #PB_Drop_Files, #PB_Drag_Copy | #PB_Drag_Move)
 
  ;Speicherpfad auslesen und in StringGadget einfügen
  ;Vorschaubild anzeigen/ show preview Image
  If a$ <> ""
    SetGadgetText(#String_FTP_UploadFile, a$)
    If FileSize(a$) > 1
      Preview = a$
      LoadDroppedFile()
    EndIf
  EndIf
 
EndProcedure

main()

Repeat
  Event = WaitWindowEvent()
  EventGadget = EventGadget()
  EventType = EventType() 
 Select Event
   Case #PB_Event_CloseWindow
      If EventWindow() = #frmMain
        Break
      EndIf
   Case #PB_Event_GadgetDrop
      If EventGadget() = #frmMain_Container Or EventGadget() = #frmMain_Image
        Preview = StringField(EventDropFiles(), 1, #LF$)
        LoadDroppedFile()
        Files$ = EventDropFiles()
        SetGadgetText(#String_FTP_UploadFile, Files$)
      EndIf
   EndSelect
ForEver

DataSection
  droppng_start:
    ; size : 4147 bytes
    Data.q $0A1A0A0D474E5089,$524448490D000000,$6F0000006F000000,$09A76D0000000208,$434369370A000037
    Data.q $4549204247527350,$322D363639313643,$969D9C780000312E,$BDCF8716D9535477,$D0948A109250BD37
    Data.q $48BD0D480252686B,$C04A1009312A2E91,$4470544436220090,$80E0283208A69151,$01858A22B19143A3
    Data.q $71D4441904EBB151,$19AD6449961B1470,$1FDF9BCDEF79BCDF,$67DDCFBD9F6B7EF7,$83FC9000BAD67DEF
    Data.q $A10C8009584CC205,$8B8D88C5E7E11458,$0300F00C01076067,$1642B3B370E0006C,$8CD87C02990246F8
    Data.q $0EBABD17F813996C,$C18C3FD32AFBF920,$312259B9949FFF00,$D9F8F2E78C985000,$9C573D38C917195C
    Data.q $4D34B698C94FB725,$32825922CE4A30CE,$F67C5B2CF2739356,$3C8432F3390F6599,$E4F065E2CE73CB19
    Data.q $8CBE12398DE327DC,$B9F808E717196091,$864974836326BE32,$4E7C19B1E46FC640,$73E62EDC92280036
    Data.q $322892632D6C6453,$C948E00079E32D82,$13CFCC582FD2F05F,$122E5ACCCEC50FCB,$86535C261988A724
    Data.q $4DCFCFE18B13938D,$8D370E30CCC58BE7,$1C591999D831E223,$1459FCCF660072E1,$38D83B22B2196D79
    Data.q $28BE6D2D6D303839,$76F7929BFC5D7FD4,$1F4419EE7F845E96,$000D997E57F6C3F8,$6D87FAD9B565A6B0
    Data.q $BB5001EB5D001569,$B28A002F60CD87FD,$7CBA1E717D0E75BE,$AB2B672CE2C4525E,$296B9F014B5CDCDC
    Data.q $437F0E9FFAEFE82F,$E5EFDDBE52CF7C5F,$3174923893F37861,$44A67A666E375E43,$E60CF970E2CEC8C4
    Data.q $1E75FE071FF8879F,$942F88BE24FC1116,$964C204CA6CB4445,$4299058813C85BB5,$C30FF89A9FF84086
    Data.q $F8DA8996B9D9A4FE,$1A21A5025896D011,$20112A28001E7E40,$0B7DEFD02B647B09,$99D18BCDF90347C6
    Data.q $577DFE82CFFB9D98,$8E7F2416C8FE4CB8,$CE5112B832444763,$002034025AFC9AEC,$03E81B40EA034045
    Data.q $00B811C0B604C013,$048828410203E00F,$01901482E0316071,$18A0B58014172044,$7506A82760AD8294
    Data.q $74187036833411A0,$812E073834E06381,$0E305201DC0460CB,$1040CC0AF029809E,$7487521510C88584
    Data.q $905885B21CC84320,$1C5011430503E41B,$1502484243250894,$86AA1CA852A0EB40,$7428E85BE866A1EA
    Data.q $51A0B7430D00BA1A,$3023077A15FA1268,$056C11B05AC1A609,$17848E08384F60B3,$822E1F3832F0C9C1
    Data.q $EE107C037095C0B7,$0A5811E097C34F84,$3A11108011A7813F,$4246C21611308BA2,$90AB211109247891
    Data.q $1E90DA406902A412,$C8A791488AB91FA4,$4C5031454506145B,$A2E285151FCA0B94,$51AAA336A156A196
    Data.q $D455D43EA89D5007,$6B464D11F50A6A28,$2C7400E8CED1CDA2,$A057462E8B9D193A,$F411E8B3E81DD09B
    Data.q $8C63A1830615FA38,$15261C4C7F188E31,$8ED31BB319B302B3,$B1A6618CC6198539,$0D8AEB1CD63AAC58
    Data.q $0AB6316C62B072C5,$8E3B057B127B107B,$38B67074E223837D,$55C42B884E3C5C5F,$1370577027705AE0
    Data.q $8CEF10DE12BC19B8,$F865F1CBF0F3C50F,$9F8E3F087E0F7C46,$4884AE098C132821,$46D092A12D612A42
    Data.q $122441784BB84B38,$B880A270C44E88F5,$1C4F3C443C495886,$362466485125BE25,$27ED216D21248129
    Data.q $C99320BD22DD229D,$DE4C593C720F6446,$BF27DF219F266E42,$F028042A582AA051,$5C2A7428D42B5614
    Data.q $F454345788A67851,$78A158AF98AC5C54,$C95E12A9F1487144,$54A55A51C4AD8948,$32B4D286E95474A3
    Data.q $794339543946D955,$1447E505F28B72B3,$8A51E143E288C52C,$845463286728FB28,$D475D4B953654FAA
    Data.q $33430D38EA59EA46,$6FB4A56952D005A6,$9D8A8A1529B48368,$71CA8D4A9E4AB44A,$E803D11BA11D2915
    Data.q $FA75FA61FA32F4E9,$EABE554F552D553B,$D5AFAA2BD536D526,$D44AD5F1A879A8E6,$D433A9DED446D5DA
    Data.q $A977A9B7D4D3D47D,$6B8469986940D3DF,$74F1AB38D1EC6AE4,$929CEE1CCB8E6D0E,$CD3584D6DCE78739
    Data.q $1CD3EE6857342334,$CAD3F2D6D2D69CD0,$9B54F5A33AD2AAD2,$FB43BDAA9DA1EDAE,$474DC7550EA4F684
    Data.q $8663CEA4E743B3A0,$F464A8CE9193C30A,$2575FD753574A631,$C67A33BA83BAF5BA,$F77AED7A857A517A
    Data.q $1DFD24FD2CFA09F4,$21063A0653FABDFA,$F10DB706AD060506,$FD865DC314C32C86,$368C628D8C8DAF86
    Data.q $0E3356323D197518,$426BBE356E37CE30,$7260D26659377136,$DD334D32CA6314CD,$4B37B3360CD97A6D
    Data.q $1DCD87321B31AB31,$D02D87CDBBE605CC,$1B8B068B42164E16,$656CC39993D3124C,$2D0B2D832DD25A8E
    Data.q $5BC55819599F2CBB,$6F6D68FAB7EAB36D,$6286C77D68DD6E9D,$ABF363D368536813,$DAF6C6B6D72D99AD
    Data.q $76E7ABB9DF5CF25C,$DBB7C76E676E7DCF,$BF621F6A9ED37763,$83A38383FED7BEC1,$31C0D1D261CDA1C8
    Data.q $0AC68B06F1D6B1D1,$793B42779D666D63,$D9D6F4E63A76AD39,$1717F9D87CEC59C1,$79A3CB8B4B9A4BA6
    Data.q $B98DE71AF3F8F3C6,$6EA55DEB5C72B9EA,$77526EBDB744B70C,$0F03FB837B8E775D,$A784C793479E0F7D
    Data.q $5E67CF41E7AA67A9,$6CD7AF0EAF225ED6,$DBC46F29F64AF667,$13E287D07BC4BBCF,$37CF57DF73ED53E5
    Data.q $6FDECFCA77D5B7D9,$FF907FB47F29DF85,$80DC015A011BFF36,$8195C0C740A980E6,$41D54105A0A4417D
    Data.q $213DC14582CD820F,$F3BB90F6C8604870,$D0828577E70BE70D,$C38CC2F7A1EDD080,$0B0F098E1F7D8596
    Data.q $10511361187F09AF,$9682C960BA80BFD1,$EF22CB22BD22AF05,$15A37AA249449944,$78C75FA39BA213A3
    Data.q $5762AD6348C794C7,$75C41388D38A5EC6,$A7E29BE3A3E363C7,$C13C70B9DC2CFA17,$45E322FAE138A13E
    Data.q $BE9C58D62C2E8B79,$47259C25C512F8F8,$EF892D893189D112,$80D2F4CE069CA139,$2EEE6CB8A74BB5A5
    Data.q $926F076F079E13EE,$26B9244FE72FCAEF,$9EDE4D764A3D2795,$54F291529EE2993C,$A7FAA79E0B5416C0
    Data.q $9FDB4D0B4EBEA5D6,$97033DBD263D29F6,$09A6114854719891,$B38732F333B532FB,$979CCBA4B38AB3CC
    Data.q $6535120A25365CED,$D934C5BBB28BD943,$325EB244C480D4CF,$3726F3935396E39A,$6F309E729E48F73A
    Data.q $F227CB4DF2D9B960,$5DC15A815EBFF37D,$7460B6B05BA05BD1,$A5AAD055FACAE7A5,$3D5A2EAFEB577AAB
    Data.q $B584B581CD6FC6BE,$2F2C2EB4287F6B69,$56914F5D662EB97C,$5BEB7EF5B1A29AD1,$B83637C5458A158B
    Data.q $38D828DA88DBA86C,$4B1F4DAAA6EE69B8,$4A2B4BAD4B172578,$CD95F8BE6EE66FDF,$65B492DA7D5F9557
    Data.q $56CC56CF6CA1CCB0,$281DB7DCDBEBD6E1,$B21EDB1F2FCF2E57,$978EC947630773BD,$51576150BCEC973B
    Data.q $195A4BB24BB08BB7,$EAB5B550655DD95C,$4D578D48F54A757D,$BBD7DAA6ED66AD7B,$56D3D8F1ECAFBB79
    Data.q $60AF6EF75A5755A7,$A306CEFABF7ACDEF,$1EFB397D987D8A86,$BAFACD7FF6374636,$7EC3E9B4A9A349B9
    Data.q $CD7D038881E97EE1,$AD652D9A2DCDCD8E,$C1C260F275A4AB70,$6CC6DDD37F78DFCB,$87021E97B7A76FAB
    Data.q $F5EDF89B7F1E8724,$B48EB08F7B8741C3,$A3B5076D5DF8677D,$95D539DE5CEA13A4,$1A3E1EEB8EED25D2
    Data.q $7BE3A7A5C7B7B478,$73563DD31FF7EFCB,$A289C209D978E55C,$953E9C9FE64E9F13,$BD63D3E4E9E9EA75
    Data.q $AD733D899CEF7A4B,$F3D9D06CF06FBC2F,$3FECF7E99DCF7CE7,$17CE0BB1FCF5DE79,$70E4BAEC5D645E8E
    Data.q $FB07E3A07EC073A9,$1C873B061D063A1F,$9E19EE5D3B2FBA87,$57D395FB8AE27C37,$D2ED7016BB9EAFBD
    Data.q $6FD751EBE191FCC8,$F9BBC9BD21B848DE,$6E73B7E7ADFA56E8,$E4B77D177359DCCF,$1BF79AFB8ABDD29E
    Data.q $3D20EA5DB1FD347E,$83C160F03A3DEA3E,$FF653F27B1DC633B,$C561F921E8BC7EF4,$C747DB23F344CE84
    Data.q $78F85E3F2F277D26,$3FC5A79993D649FC,$77D9E4CCFB5CFF2B,$353B153032FC78BF,$5F9BAFD3FCF45CFE
    Data.q $EF65EED2FFD8BFA8,$66AF1957FDF4D874,$2DE0737F51BC975E,$33137798BBFF6DEB,$7E983F2BEFB1EFB9
    Data.q $8CA7EEF1F418F9E8,$FBF384F7037E9F4F,$090000002A66708F,$C30E000073594870,$A86FC701C30E0000
    Data.q $414449A205000064,$E253699AED9C7854,$9045415051861040,$FE97F8F05114054B,$872A05A288AD6F4A
    Data.q $28B76A15BEE8AA72,$3F6C50CCE9210993,$CC9F193092B6B61F,$F1393938124CF774,$60A6607754044431
    Data.q $2526D84A4DB0949B,$A4DB0949B612936C,$9B612936C2526D84,$6C2526D84A4DB094,$84A4DB0949B61293
    Data.q $949B612936C2526D,$936C2526D84A4DB0,$6D84A4DB0949B612,$B0949B612936C252,$12936C2526D84A4D
    Data.q $526D84A4DB0949B6,$BF7E9B6A992936C2,$3067E7E7FE7E7E7F,$74CF19DDD55FE018,$1C3468D102040CD9
    Data.q $37383060A142870E,$AF47C7C7D4EFF737,$DD9B366F7F7F7BD7,$9B16982D2761576E,$48911B1B1BABABAB
    Data.q $6B6B3A8B28E0D464,$2A54E9D3A64C996B,$BD56036D3EBD7A95,$681D9D9DA5A5A5CD,$3E7CE5E5E593FFB2
    Data.q $5A30952A55B5B5BF,$4A99B628A4DBEBBD,$835A3C68ACD9B2A5,$2E5A418070707050,$8309B32A9064A797
    Data.q $3B65CC58B1BBBBBB,$DF373737B2080F88,$9B1A83731D24DFDF,$16DD9A2614285950,$A5757578B1629DA0
    Data.q $2A547A889B1AA85C,$C2508C4DA1892087,$E6E6E6E6C0A01D36,$FAD030CBD8FAFAFA,$644E4A17D7D7FEFD
    Data.q $C2B4A3D7D64F142A,$6413A6EA251847AC,$1716D3A74E3A44DB,$4356AD4BCBCBE240,$3C78C3F05B9A3419
    Data.q $145BF4572024489E,$C7B280CF03468D4F,$0C8B218A26DB2093,$F3F3FEFEFEF2128E,$CB97A183A3AA78D3
    Data.q $5042A32D025144E5,$B2BE7144DAA5DF38,$D56AD58F0B3A22B2,$0CA06D9088AC05BA,$78A477CC02F4DA93
    Data.q $45311136A9258B55,$6CDB3F3F3F8750A7,$4C993DF301E1E1E7,$741CD34D68859E9A,$F32093226CF23DCF
    Data.q $72AFB57D7D7A9E9A,$F1A9823986320608,$E496A92B5C278614,$99A86D6471E514D9,$A3A3E70C282435B4
    Data.q $F6C78FDFBF29E323,$CF235D177136F6F6,$03060E54607528A6,$C3D22C6DDBB60D07,$4DB8CE0E14F1B0E1
    Data.q $36E3B9A7D3E959D3,$8D797BA29B535BF1,$C680980B0B0B9B24,$20068ACDC71D7DE3,$A6C920DD36E3B462
    Data.q $8B34DCF5EBD32568,$2EC69CF8C25114CA,$A6074D5DD2423C9C,$C60B465B2E414F4F,$4536491AF3B745C6
    Data.q $A0B6C73676CE8FFB,$76D6514D9253BB6A,$BFDB22225750E019,$E9A11589B248D79D,$780A3695375F2471
    Data.q $B248D79DBA29B1D3,$7F1717170BF85F09,$248B8EF5540B871D,$B979246DAABDD6D1,$C71E371E3C76950F
    Data.q $78748839AB56BDE2,$7135AB56820DA636,$E9A1B513679028FF,$E9E9F421060C1F1F,$2C94F7362D06D269
    Data.q $D30D1A366D327C84,$8BB76EE9D3A410DA,$4489100786B7EC0B,$63AC659729A14F4C,$25F68BAA6E1CD9E4
    Data.q $B794C34D34F6F6F7,$59D11932665414D3,$CD75235D1761C5DC,$ABE9A4C99254A950,$77458F3E7CD9CC08
    Data.q $C1C8B1E928B65CB9,$2FFEDF84AD78B704,$66CC7C7C7C10B136,$414C0489120BA2B3,$578473FDAFFCB207
    Data.q $1E0E75EB0C3C5D84,$D5B3D7B2C0F7C286,$7D8DB68A8D1A356A,$E11641074370A2FA,$569BE4516C306A0F
    Data.q $27675D10A14246E9,$B7B7B742544DB646,$C5AB40ED63C7C7C7,$DD930A54A911244B,$CC16BD8282408541
    Data.q $8F43C3C3CBCBCBF7,$AFA4E84021507A76,$7C298573B3504846,$88DA3C1428517171,$45EEBD7AD082A644
    Data.q $CF420BAAFB2816E3,$3EEF9D9CB972CECE,$19725791010A801C,$A188B5FC438BF2AF,$BC25C6DBDBDB4A48
    Data.q $2478BFC042A39F9D,$23EFEFEC8E1145C6,$478EFEA26DDBB4A4,$CD9B350258B0D7FD,$0E7DF36204862C58
    Data.q $DE4532B0CEB3EF22,$2C5B61450A3448C7,$DEA0AC7DA4521116,$A3083AAFF44F4FA6,$0A90AFCE8509FAC3
    Data.q $F7930B56AD0E0871,$D58A108F88C4F7D7,$4FC700C2805D7194,$CD854F1FECE54F4F,$9F4F8E8AFDFBF47F
    Data.q $AEB674C2981D7EAA,$8D1231A931BA31C9,$A74E9B3C7ECA3DB5,$47365D32FFBF61E3,$E23D79B1D2FA68C1
    Data.q $6D209D69B9F9F9E3,$00A1003A6D7A7E2B,$3223B25F47B53142,$3D3E9B299E3CDB48,$EE1CDEA35F5F5EBC
    Data.q $BB49DDDDDDC522A5,$D35E29E9F4D9ACFB,$5BCCBFFC34A952B4,$DC8DFE3321CDA0CF,$C2526D84A4DB00FF
    Data.q $4A4DB0949B612936,$49B612936C2526D8,$36C2526D84A4DB09,$D84A4DB0949B6129,$0949B612936C2526
    Data.q $2936C2526D84A4DB,$26D84A4DB0949B61,$DB0949B612936C25,$612936C2526D84A4,$2526D84A4DB0949B
    Data.q $AE1FC949B612936C,$00E013DE4C214161,$AE444E4549000000
    Data.b $42,$60,$82
  droppng_end:
EndDataSection



alles in allem benutz ich es hier:

Bild

_________________
PureBasic v5.44 LTS + v5.72 LTS | Windows 7 x64 - Gforce GTX 1060 - AMD FX6200 Six Core 3.80 | 26GB RAM


Nach oben
 Profil  
Mit Zitat antworten  
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Ein neues Thema erstellen Auf das Thema antworten  [ 1 Beitrag ] 

Alle Zeiten sind UTC + 1 Stunde [ Sommerzeit ]


Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 9 Gäste


Sie dürfen keine neuen Themen in diesem Forum erstellen.
Sie dürfen keine Antworten zu Themen in diesem Forum erstellen.
Sie dürfen Ihre Beiträge in diesem Forum nicht ändern.
Sie dürfen Ihre Beiträge in diesem Forum nicht löschen.

Suche nach:
Gehe zu:  

 


Powered by phpBB © 2008 phpBB Group | Deutsche Übersetzung durch phpBB.de
subSilver+ theme by Canver Software, sponsor Sanal Modifiye