seres Posted April 15, 2016 Share Posted April 15, 2016 hello, im currently creating an image viewer, i got re-sizing good, but when i want to display the full size picture the scrolling doesn't respond, here is my code: expandcollapse popup#include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #Include <Math.au3> $AreaWidth = 1224 $AreaHeight = 768 $centerximg = 0 $centeryimg = 0 $NewImageWidth = 0 $NewImageHeight = 0 $idPic = "" $centerx=$AreaWidth / 2 $centery= $AreaHeight / 2 Opt("GUIOnEventMode", 1) ; Change to OnEvent mode $mainwindow = GUICreate("Hello World", $AreaWidth, $AreaHeight, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_HSCROLL, $WS_VSCROLL )) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") GUISetOnEvent($GUI_EVENT_MAXIMIZE, "resize") GUISetOnEvent($GUI_EVENT_RESIZED, "resize") GUISetOnEvent($GUI_EVENT_RESTORE, "resize") _GDIPlus_Startup() $ImgLoad = @ScriptDir & "\3.jpg" $IMG = _GDIPlus_ImageLoadFromFile($ImgLoad) ; Calculate the ratio of the image $ImageWidth = _GDIPlus_ImageGetWidth($IMG) $ImageHeight = _GDIPlus_ImageGetHeight($IMG) _GDIPlus_ImageDispose($IMG) _GDIPlus_Shutdown() ;$ratio = $ImageWidth/$ImageHeight ; set dimensions ; The width is calculated from the Height ;$GuiH = 600 WinWaitActive("Hello World") ;resize() ;$idPic = GUICtrlCreatePic($ImgLoad, 0, 0, $GuiH*$ratio, $GuiH) ;$idPic = GUICtrlCreatePic($ImgLoad, $centerximg, $centeryimg, $NewImageWidth, $NewImageHeight) $idPic2 = GUICtrlCreatePic($ImgLoad, $centerximg, $centeryimg, $ImageWidth, $ImageHeight) ;ConsoleWrite(Round($NewImageWidth) & 'x' & Round($NewImageHeight) & @CR) While 1 Sleep(1000) ; Idle around WEnd Link to comment Share on other sites More sharing options...
UEZ Posted April 15, 2016 Share Posted April 15, 2016 Does this help? Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 15, 2016 Moderators Share Posted April 15, 2016 seres, Or you could use my Scrollbars UDF - the link is in my sig. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
seres Posted April 15, 2016 Author Share Posted April 15, 2016 7 hours ago, Melba23 said: seres, Or you could use my Scrollbars UDF - the link is in my sig. M23 wow thanks it was really simple to use, but i have one question, once i activate the scrolling window, what is the best way to disable it, so the scrolling bars disappeared Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 15, 2016 Moderators Share Posted April 15, 2016 seres, Why would you want to disable the scrollbars? Let me see the script you have been using and explain exactly what you want to happen. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
seres Posted April 15, 2016 Author Share Posted April 15, 2016 1 hour ago, Melba23 said: seres, Why would you want to disable the scrollbars? Let me see the script you have been using and explain exactly what you want to happen. M23 it's just for visual style, im trying to create an image viewer with modifying options(bicubic, etc), i already make it resizable for the window width and heigh, but i needed an option to use actual size with scrolling(im planning to use a button for this), but once it is activated the scrolling bars won't disappear even when i make the image resizable again right now im in school, i dont have the full code, only the one i posted expandcollapse popup#include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #Include <Math.au3> #include "GUIScrollbars_Ex.au3" $AreaWidth = 600 $AreaHeight = 468 $centerximg = 0 $centeryimg = 0 $NewImageWidth = 0 $NewImageHeight = 0 $idPic = "" $centerx=$AreaWidth / 2 $centery= $AreaHeight / 2 Opt("GUIOnEventMode", 1) ; Change to OnEvent mode $mainwindow = GUICreate("Hello World", $AreaWidth, $AreaHeight, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX )) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") GUISetOnEvent($GUI_EVENT_MAXIMIZE, "disable") ;GUISetOnEvent($GUI_EVENT_RESIZED, "resize") ;GUISetOnEvent($GUI_EVENT_RESTORE, "resize") _GDIPlus_Startup() $ImgLoad = @ScriptDir & "\3.jpg" $IMG = _GDIPlus_ImageLoadFromFile($ImgLoad) ; Calculate the ratio of the image $ImageWidth = _GDIPlus_ImageGetWidth($IMG) $ImageHeight = _GDIPlus_ImageGetHeight($IMG) _GDIPlus_ImageDispose($IMG) _GDIPlus_Shutdown() ;$ratio = $ImageWidth/$ImageHeight ; set dimensions ; The width is calculated from the Height ;$GuiH = 600 WinWaitActive("Hello World") ;resize() ;$idPic = GUICtrlCreatePic($ImgLoad, 0, 0, $GuiH*$ratio, $GuiH) ;$idPic = GUICtrlCreatePic($ImgLoad, $centerximg, $centeryimg, $NewImageWidth, $NewImageHeight) $idPic2 = GUICtrlCreatePic($ImgLoad, $centerximg, $centeryimg, $ImageWidth, $ImageHeight) _GUIScrollbars_Generate($mainwindow, $ImageWidth, $ImageHeight, 0, 0, Default, 7) ;ConsoleWrite(Round($NewImageWidth) & 'x' & Round($NewImageHeight) & @CR) While 1 Sleep(1000) ; Idle around WEnd Func disable() _GUIScrollbars_Generate($mainwindow, 0, 0, 0, 0, Default, 7) EndFunc Func CLOSEClicked() Exit EndFunc Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 15, 2016 Moderators Share Posted April 15, 2016 seres, I understand the requirement now. Quote right now im in school, i dont have the full code No problem - just post it when you can. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
seres Posted April 15, 2016 Author Share Posted April 15, 2016 2 hours ago, Melba23 said: seres, I understand the requirement now. No problem - just post it when you can. M23 hello, here is my full code expandcollapse popup#include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #Include <Math.au3> #include <GUIConstantsEx.au3> #include "GUIScrollbars_Ex.au3" $AreaWidth = 1224 $AreaHeight = 768 $centerximg = 0 $centeryimg = 0 $NewImageWidth = 0 $NewImageHeight = 0 $idPic = "" $centerx=$AreaWidth / 2 $centery= $AreaHeight / 2 Opt("GUIOnEventMode", 1) ; Change to OnEvent mode $mainwindow = GUICreate("Hello World", $AreaWidth, $AreaHeight, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MINIMIZEBOX, $WS_MAXIMIZEBOX, $WS_SIZEBOX )) $hButton_1 = GUICtrlCreateButton("full size enab/disab", 0, 0, 200, 30) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") GUISetOnEvent($GUI_EVENT_MAXIMIZE, "resize") GUISetOnEvent($GUI_EVENT_RESIZED, "resize") GUISetOnEvent($GUI_EVENT_RESTORE, "resize") _GDIPlus_Startup() $ImgLoad = @ScriptDir & "\3.jpg" $IMG = _GDIPlus_ImageLoadFromFile($ImgLoad) ; Calculate the ratio of the image $ImageWidth = _GDIPlus_ImageGetWidth($IMG) $ImageHeight = _GDIPlus_ImageGetHeight($IMG) _GDIPlus_ImageDispose($IMG) _GDIPlus_Shutdown() ;$ratio = $ImageWidth/$ImageHeight ; set dimensions ; The width is calculated from the Height ;$GuiH = 600 WinWaitActive("Hello World") resize() ;$idPic = GUICtrlCreatePic($ImgLoad, 0, 0, $GuiH*$ratio, $GuiH) $idPic = GUICtrlCreatePic($ImgLoad, $centerximg, $centeryimg, $NewImageWidth, $NewImageHeight) ;$idPic2 = GUICtrlCreatePic($ImgLoad, $centerximg, $centeryimg, $ImageWidth, $ImageHeight) ;_GUIScrollbars_Generate($mainwindow, $ImageWidth, $ImageHeight, 0, 0, Default, 7) While 1 Sleep(1000) ; Idle around WEnd Func resize() $aPos = WinGetPos("[ACTIVE]") $Scale = _Min($aPos[2] / $ImageWidth, $aPos[3] / $ImageHeight) $NewImageWidth = $ImageWidth * $Scale $NewImageHeight = $ImageHeight * $Scale $centerximg = ($aPos[2] / 2) - ($NewImageWidth / 2) $centeryimg = ($aPos[3] / 2) - ($NewImageHeight / 2) ;$idPic = GUICtrlCreatePic($ImgLoad, 0, 0, $GuiH*$ratio, $GuiH) If $idPic <> "" Then GUICtrlSetPos($idPic, $centerximg, $centeryimg, $NewImageWidth, $NewImageHeight) EndIf EndFunc Func CLOSEClicked() Exit EndFunc Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now