Advertisement
name22

GUIHole Example

May 15th, 2011
583
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 3.27 KB | None | 0 0
  1. #include <GUIConstants.au3>
  2. #include <GDIPlus.au3>
  3.  
  4. ; -Author: name22 (www.autoit.de)
  5.  
  6. $hWnd = GUICreate("Example by name22", 400, 400)
  7. $cDummy_Start = GUICtrlCreateDummy()
  8. $cButton1 = GUICtrlCreateButton("Button 1", 50, 50, 100, 50)
  9. $cButton2 = GUICtrlCreateButton("Button 2", 70, 200, 100, 50)
  10. $cDummy_End = GUICtrlCreateDummy()
  11. GUISetState()
  12.  
  13. _GDIPlus_Startup()
  14.  
  15. $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hWnd)
  16. _GDIPlus_GraphicsSetSmoothingMode($hGraphics, 2)
  17.  
  18. For $i = $cDummy_Start + 1 To $cDummy_End - 1
  19.     $aPos = ControlGetPos($hWnd, "", $i)
  20.     ConsoleWrite($aPos[0] & @CRLF)
  21.     _GDIPlus_GraphicsSetClipRect($hGraphics, $aPos[0], $aPos[1], $aPos[2], $aPos[3], 3)
  22. Next
  23.  
  24. _GDIPlus_GraphicsFillEllipse($hGraphics, 20, 20, 300, 300)
  25.  
  26. While True
  27.     Switch GUIGetMsg()
  28.         Case $GUI_EVENT_CLOSE
  29.             Exit
  30.         Case $cButton1
  31.             MsgBox(64, "Click", "Button 1")
  32.         Case $cButton2
  33.             MsgBox(64, "Click", "Button 2")
  34.     EndSwitch
  35. WEnd
  36.  
  37.  
  38. ; #FUNCTION# ====================================================================================================================
  39. ; Name...........: _GDIPlus_GraphicsSetClipRect
  40. ; Description ...: Updates the clipping region of a Graphics object to a region that is the combination of itself and a rectangle
  41. ; Syntax.........: _GDIPlus_GraphicsSetClipRect($hGraphics, $nX, $nY, $nWidth, $nHeight[, $iCombineMode = 0])
  42. ; Parameters ....: $hGraphics - Pointer to a Graphics object
  43. ;                  $nX        - X coordinate of the upper-left corner of the rectangle
  44. ;                  $nY        - Y coordinate of the upper-left corner of the rectangle
  45. ;                  $nWidth    - Width of the rectangle
  46. ;                  $nHeight   - Height of the rectangle
  47. ;                  $iCombineMode - Regions combination mode:
  48. ;                  |0 - The existing region is replaced by the new region
  49. ;                  |1 - The existing region is replaced by the intersection of itself and the new region
  50. ;                  |2 - The existing region is replaced by the union of itself and the new region
  51. ;                  |3 - The existing region is replaced by the result of performing an XOR on the two regions
  52. ;                  |4 - The existing region is replaced by the portion of itself that is outside of the new region
  53. ;                  |5 - The existing region is replaced by the portion of the new region that is outside of the existing region
  54. ; Return values .: Success      - True
  55. ;                  Failure      - False and either:
  56. ;                  |@error and @extended are set if DllCall failed
  57. ;                  |$GDIP_STATUS contains a non zero value specifying the error code
  58. ; Remarks .......: None
  59. ; Related .......: None
  60. ; Link ..........; @@MsdnLink@@ GdipSetClipRect
  61. ; Example .......; No
  62. ; ===============================================================================================================================
  63. Func _GDIPlus_GraphicsSetClipRect($hGraphics, $nX, $nY, $nWidth, $nHeight, $iCombineMode = 0)
  64.     Local $aResult = DllCall($ghGDIPDll, "uint", "GdipSetClipRect", "hwnd", $hGraphics, "float", $nX, "float", $nY, "float", $nWidth, "float", $nHeight, "int", $iCombineMode)
  65.  
  66.     If @error Then Return SetError(@error, @extended, False)
  67.     $GDIP_STATUS = $aResult[0]
  68.     Return $aResult[0] = 0
  69. EndFunc   ;==>_GDIPlus_GraphicsSetClipRect
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement