SHARE
TWEET

_SendImageToPicControl

HongTamRD Feb 23rd, 2019 253 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Func _SendImageToPicControl($iCtrlID, $sImage, $x = 0)
  2.     If $x = 0 Then
  3.         Local $hImage = _GDIPlus_ImageLoadFromFile($sImage)
  4.     Else
  5.         Local $hImage = _GDIPlus_BitmapCreateFromMemory(Binary($sImage))
  6.     EndIf
  7.     $PosPic = ControlGetPos($Gui, "", $iCtrlID)
  8.     If @error Then $PosPic = ControlGetPos($cGui, "", $iCtrlID)
  9.     If @error Then $PosPic = ControlGetPos($mGui, "", $iCtrlID)
  10.     If @error Then $PosPic = ControlGetPos($GuiTT, "", $iCtrlID)
  11.     $hImageR = _GDIPlus_ImageResize($hImage, $PosPic[2], $PosPic[3])
  12.     Local $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImageR)
  13. ;~  GUICtrlSetImage($iCtrlID, "")
  14.     _WinAPI_DeleteObject(GUICtrlSendMsg($iCtrlID, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap))
  15.     _WinAPI_DeleteObject($hHBitmap)
  16.     _GDIPlus_ImageDispose($hImageR)
  17.     _GDIPlus_ImageDispose($hImage)
  18. ;~  GUICtrlSetState($iCtrlID, $GUI_HIDE)
  19.     GUICtrlSetState($iCtrlID, $GUI_SHOW)
  20. EndFunc   ;==>_SendImageToPicControl
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top