Parsix Posted September 20, 2018 Share Posted September 20, 2018 i put a pic control in form i need visual selection for crop picture (visual selection --return--> X1Y1,X2Y2) solution? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 21, 2018 Moderators Share Posted September 21, 2018 Parsix, I posted a couple of example scripts in this thread which might help: 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...
UEZ Posted September 22, 2018 Share Posted September 22, 2018 (edited) Just an non-perfect example which you can start with: expandcollapse popup;coded by UEZ build 2018-09-22 beta #include <Array.au3> #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WinAPIRes.au3> #include <WinAPISysWin.au3> #include <WindowsConstants.au3> Global $__g_hGUI_MarkArea, $__g_iLabel_TL, $__g_iLabel_TM, $__g_iLabel_TR, $__g_iLabel_LM, $__g_iLabel_RM, $__g_iLabel_BL, $__g_iLabel_BM, _ $__g_iLabel_BR, $__g_iOldCursor, $__g_iW, $__g_iH, $__g_iColor_ResizeDots = 0xFFFFFF, $__g_iBorder = 4 Global $aRect = _GDIPlus_MarkArea() _ArrayDisplay($aRect, "Selection Coordinates") Func _GDIPlus_MarkArea() _GDIPlus_Startup() $__g_hGUI_MarkArea = GUICreate("", 1, 1, -1, -1, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_LAYERED)) GUISetBkColor(0xABCDEF, $__g_hGUI_MarkArea) $__g_iLabel_TL = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;top left GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_TM = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;top mid GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_TR = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;top right GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_LM = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;left mid GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_RM = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;right mid GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_BL = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;bottom left GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_BM = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;bottom mid GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iLabel_BR = GUICtrlCreateLabel("", 0, 0, $__g_iBorder, $__g_iBorder) ;bottom right GUICtrlSetResizing(-1, $GUI_DOCKSIZE) GUICtrlSetBkColor(-1, $__g_iColor_ResizeDots) $__g_iOldCursor = MouseGetCursor() GUISetCursor(3, 1, $__g_hGUI_MarkArea) GUISetState(@SW_SHOW, $__g_hGUI_MarkArea) _WinAPI_SetLayeredWindowAttributes($__g_hGUI_MarkArea, 0xABCDEF, 0xF0, 3) Local $aMPos, $aPrevMPos[2] = [MouseGetPos(0) + 1, MouseGetPos(1) + 1], $iID, $aCI, $iX, $iY, $bLMPressed = False Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE GUIRegisterMsg($WM_TIMER, "") DllCall("user32.dll", "bool", "KillTimer", "hwnd", $__g_hGUI_MarkArea, "uint_ptr", $iID) _GDIPlus_Shutdown() Local $aResult = WinGetPos($__g_hGUI_MarkArea) GUIDelete($__g_hGUI_MarkArea) Return $aResult EndSwitch $aMPos = MouseGetPos() If $aMPos[0] <> $aPrevMPos[0] Or $aMPos[1] <> $aPrevMPos[1] And Not $bLMPressed Then WinMove($__g_hGUI_MarkArea, "", $aMPos[0], $aMPos[1]) $aPrevMPos = $aMPos EndIf $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) If $bLMPressed = True Then Switch $aCI[4] Case $__g_iLabel_TL, $__g_iLabel_BR GUISetCursor(12, 1, $__g_hGUI_MarkArea) Case $__g_iLabel_TR, $__g_iLabel_BL GUISetCursor(10, 1, $__g_hGUI_MarkArea) Case $__g_iLabel_LM, $__g_iLabel_RM GUISetCursor(13, 1, $__g_hGUI_MarkArea) Case $__g_iLabel_TM, $__g_iLabel_BM GUISetCursor(11, 1, $__g_hGUI_MarkArea) Case Else GUISetCursor($__g_iOldCursor, 1, $__g_hGUI_MarkArea) EndSwitch EndIf If $aCI[2] And Not $bLMPressed Then $aGUIStartPos = WinGetPos($__g_hGUI_MarkArea) GUIRegisterMsg($WM_TIMER, "PlayAnim") $iID = DllCall("User32.dll", "uint_ptr", "SetTimer", "hwnd", $__g_hGUI_MarkArea, "uint_ptr", 1, "uint", 30, "ptr", 0)[0] While $aCI[2] $aCI = GUIGetCursorInfo($__g_hGUI_MarkArea) $aMPos = MouseGetPos() $__g_iW = Abs($aMPos[0] - $aGUIStartPos[0]) + 1 $__g_iH = Abs($aMPos[1] - $aGUIStartPos[1]) + 1 If $aMPos[0] < $aGUIStartPos[0] Then $iX = $aMPos[0] Else $iX = $aGUIStartPos[0] EndIf If $aMPos[1] < $aGUIStartPos[1] Then $iY = $aMPos[1] Else $iY = $aGUIStartPos[1] EndIf WinMove($__g_hGUI_MarkArea, "", $iX, $iY, $__g_iW, $__g_iH) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_TM, ($__g_iW - $__g_iBorder) / 2, 0, $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_TR, ($__g_iW - $__g_iBorder), 0, $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_LM, 0, ($__g_iH - $__g_iBorder) / 2, $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_RM, ($__g_iW - $__g_iBorder), ($__g_iH - $__g_iBorder) / 2, $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_BL, 0, ($__g_iH - $__g_iBorder), $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_BM, ($__g_iW - $__g_iBorder) / 2, ($__g_iH - $__g_iBorder), $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_BR, ($__g_iW - $__g_iBorder), ($__g_iH - $__g_iBorder), $__g_iBorder, $__g_iBorder) ControlMove($__g_hGUI_MarkArea, "", $__g_iLabel_BR, ($__g_iW - $__g_iBorder), ($__g_iH - $__g_iBorder), $__g_iBorder, $__g_iBorder) WEnd $bLMPressed = True GUISetCursor($__g_iOldCursor, 1, $__g_hGUI_MarkArea) EndIf Until False EndFunc ;==>_GDIPlus_MarkArea Func PlayAnim() Local Static $fOffset = 0 Local Const $iSize = $__g_iBorder / 2 Local Const $hDC = _WinAPI_GetDC($__g_hGUI_MarkArea) Local Const $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $__g_iW, $__g_iH) Local Const $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC) Local Const $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hHBitmap) Local Const $hCanvas = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer) Local Const $hPen = _GDIPlus_PenCreate(0xFF0178D7, $iSize), $hPen2 = _GDIPlus_PenCreate(0xFFFFFFFF, $iSize), _ $hBrush = _GDIPlus_BrushCreateSolid(0xFFFFFFFF) _GDIPlus_PenSetDashStyle($hPen, $GDIP_DASHSTYLEDASHDOTDOT) _GDIPlus_GraphicsClear($hCanvas, 0xFFABCDEF) _GDIPlus_GraphicsDrawRect($hCanvas, 1 + $iSize, 1 + $iSize, $__g_iW - 2 * $iSize - 2, $__g_iH - 2 * $iSize - 2, $hPen2) DllCall($__g_hGDIPDll, "int", "GdipSetPenDashOffset", "handle", $hPen, "float", $fOffset) _GDIPlus_GraphicsDrawRect($hCanvas, 1 + $iSize, 1 + $iSize, $__g_iW - 2 * $iSize - 2, $__g_iH - 2 * $iSize - 2, $hPen) _GDIPlus_GraphicsFillRect($hCanvas, 0, 0, $__g_iBorder + 1, $__g_iBorder + 1, $hBrush) _GDIPlus_GraphicsDrawRect($hCanvas, 0, 0, $__g_iBorder + 1, $__g_iBorder + 1) _GDIPlus_GraphicsFillRect($hCanvas, ($__g_iW - $__g_iBorder) / 2, 0, $__g_iBorder + 1, $__g_iBorder + 1, $hBrush) _GDIPlus_GraphicsDrawRect($hCanvas, ($__g_iW - $__g_iBorder) / 2, 0, $__g_iBorder + 1, $__g_iBorder + 1) _GDIPlus_GraphicsFillRect($hCanvas, ($__g_iW - $__g_iBorder) - 2, 0, $__g_iBorder + 1, $__g_iBorder + 1, $hBrush) _GDIPlus_GraphicsDrawRect($hCanvas, ($__g_iW - $__g_iBorder) - 2, 0, $__g_iBorder + 1, $__g_iBorder + 1) _GDIPlus_GraphicsFillRect($hCanvas, 0, ($__g_iH - $__g_iBorder) / 2, $__g_iBorder + 1, $__g_iBorder + 1, $hBrush) _GDIPlus_GraphicsDrawRect($hCanvas, 0, ($__g_iH - $__g_iBorder) / 2, $__g_iBorder + 1, $__g_iBorder + 1) _GDIPlus_GraphicsFillRect($hCanvas, ($__g_iW - $__g_iBorder) - 2, ($__g_iH - $__g_iBorder) / 2, $__g_iBorder + 1, $__g_iBorder + 1, $hBrush) _GDIPlus_GraphicsDrawRect($hCanvas, ($__g_iW - $__g_iBorder) - 2, ($__g_iH - $__g_iBorder) / 2, $__g_iBorder + 1, $__g_iBorder + 1) _GDIPlus_GraphicsFillRect($hCanvas, 0, ($__g_iH - $__g_iBorder) - 2, $__g_iBorder + 1, $__g_iBorder + 1, $hBrush) _GDIPlus_GraphicsDrawRect($hCanvas, 0, ($__g_iH - $__g_iBorder) - 2, $__g_iBorder + 1, $__g_iBorder + 1) _GDIPlus_GraphicsFillRect($hCanvas, ($__g_iW - $__g_iBorder) / 2, ($__g_iH - $__g_iBorder) - 2, $__g_iBorder + 1, $__g_iBorder + 1, $hBrush) _GDIPlus_GraphicsDrawRect($hCanvas, ($__g_iW - $__g_iBorder) / 2, ($__g_iH - $__g_iBorder) - 2, $__g_iBorder + 1, $__g_iBorder + 1) _GDIPlus_GraphicsFillRect($hCanvas, ($__g_iW - $__g_iBorder) - 2, ($__g_iH - $__g_iBorder) - 2, $__g_iBorder + 1, $__g_iBorder + 1, $hBrush) _GDIPlus_GraphicsDrawRect($hCanvas, ($__g_iW - $__g_iBorder) - 2, ($__g_iH - $__g_iBorder) - 2, $__g_iBorder + 1, $__g_iBorder + 1) _WinAPI_BitBlt($hDC, 0, 0, $__g_iW, $__g_iH, $hDC_backbuffer, 0, 0, $SRCCOPY) $fOffset += 0.5 _GDIPlus_GraphicsDispose($hCanvas) _WinAPI_SelectObject($hDC_backbuffer, $DC_obj) _WinAPI_DeleteDC($hDC_backbuffer) _WinAPI_DeleteObject($hHBitmap) _WinAPI_ReleaseDC($__g_hGUI_MarkArea, $hDC) _GDIPlus_PenDispose($hPen) _GDIPlus_PenDispose($hPen2) _GDIPlus_BrushDispose($hBrush) EndFunc ;==>PlayAnim Just mark an area on your desktop by holding down the left mouse button. The resize function of the marked area is not added yet. Look here for the full version: Edited September 25, 2018 by UEZ Danyfirex 1 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...
Parsix Posted October 6, 2018 Author Share Posted October 6, 2018 UEZ thanks, how to accept Selected area? only crop a section of pic control is needed Melba23 not worked for me Link to comment Share on other sites More sharing options...
UEZ Posted October 7, 2018 Share Posted October 7, 2018 On 10/6/2018 at 4:05 PM, Parsix said: UEZ thanks, how to accept Selected area? only crop a section of pic control is needed When you have selected an area on your desktop press ESC. The function _GDIPlus_MarkArea() will return an array with x, y, w, h values. 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...
Parsix Posted October 8, 2018 Author Share Posted October 8, 2018 10 hours ago, UEZ said: When you have selected an area on your desktop press ESC. The function _GDIPlus_MarkArea() will return an array with x, y, w, h values. How to Limit it to _GDIPlus_GraphicsDrawImageRect ? Link to comment Share on other sites More sharing options...
UEZ Posted October 8, 2018 Share Posted October 8, 2018 1 hour ago, Parsix said: How to Limit it to _GDIPlus_GraphicsDrawImageRect ? It do not know what you want to ask with that question! 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...
Parsix Posted October 8, 2018 Author Share Posted October 8, 2018 nothing, thank you 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