AndreyS Posted November 9, 2009 Share Posted November 9, 2009 Please'll show how to do so in order to Picture control display pictures small size of the center? Thanks! Link to comment Share on other sites More sharing options...
GEOSoft Posted November 9, 2009 Share Posted November 9, 2009 Please show some of the code you have tried to give us a bit of a headstart, my crystal ball is a bit foggy right now. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
AndreyS Posted November 9, 2009 Author Share Posted November 9, 2009 No problems! ... $avatar = GUICtrlCreatePic("", 25, 140, 130, 130, $WS_BORDER) ... Func ChangeAvatar() GUICtrlDelete($avatar2) $avatar = GUICtrlCreatePic("...\avatar.jpg", 25, 140, 0, 0, BitOR($SS_NOTIFY,$SS_RIGHTJUST)) EndFunc ;==>ChangeAvatar ... Pictures are loaded (avatar.jpg) size 60x90, 100x70 px and other... Link to comment Share on other sites More sharing options...
AndreyS Posted November 13, 2009 Author Share Posted November 13, 2009 So it is not possible to do same? Link to comment Share on other sites More sharing options...
Zedna Posted November 13, 2009 Share Posted November 13, 2009 (edited) First of all simpler way of changing image: ChangeAvatar("C:\avatar.jpg") Func ChangeAvatar($image) GUICtrlSetImage($avatar, $image) EndFunc ;==>ChangeAvatar As about centering/shrinking images I'm not sure but I remember somebody on this forum showed ideas about that already. Try to search for it. Edited November 13, 2009 by Zedna Resources UDF Â ResourcesEx UDF Â AutoIt Forum Search Link to comment Share on other sites More sharing options...
AndreyS Posted November 13, 2009 Author Share Posted November 13, 2009 The picture clearly not centered in this way! And even in the form of leaves traces of the previous pictures... Link to comment Share on other sites More sharing options...
Yashied Posted November 13, 2009 Share Posted November 13, 2009 expandcollapse popup#Include <GDIPlus.au3> #Include <WinAPI.au3> #Include <WindowsConstants.au3> GUICreate('MyGUI', 400, 400) $Pic = GUICtrlCreatePic('', 0, 0, 400, 400) _GUICtrlSetImage($Pic, RegRead('HKLM\SOFTWARE\AutoIt v3\AutoIt', 'InstallDir') & '\Examples\GUI\logo4.gif', 0) ;_GUICtrlSetImage($Pic, RegRead('HKLM\SOFTWARE\AutoIt v3\AutoIt', 'InstallDir') & '\Examples\GUI\logo4.gif') GUISetState() Do Until GUIGetMsg() = -3 Func _GUICtrlSetImage($hWnd, $sImage, $fScale = 1) Local Const $STM_SETIMAGE = 0x0172 Local Const $STM_GETIMAGE = 0x0173 If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd) If $hWnd = 0 Then Return 0 EndIf EndIf Local $Res, $tRect, $hImage, $hBitmap, $hBmp, $hObj, $Width, $Height, $hDC, $hDestDC, $hSrcDC _GDIPlus_Startup() $hImage = _GDIPlus_BitmapCreateFromFile($sImage) $Width = _GDIPlus_ImageGetWidth($hImage) $Height = _GDIPlus_ImageGetHeight($hImage) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() If Not $hBitmap Then Return 0 EndIf $tRect = _WinAPI_GetClientRect($hWnd) $W = DllStructGetData($tRect, 3) - DllStructGetData($tRect, 1) $H = DllStructGetData($tRect, 4) - DllStructGetData($tRect, 2) $hDC = _WinAPI_GetDC($hWnd) $hDestDC = _WinAPI_CreateCompatibleDC($hDC) $hBmp = _WinAPI_CreateCompatibleBitmap($hDC, $W, $H) _WinAPI_SelectObject($hDestDC, $hBmp) $hSrcDC = _WinAPI_CreateCompatibleDC($hDC) _WinAPI_SelectObject($hSrcDC, $hBitmap) If $fScale Then $Res = DllCall('gdi32.dll', 'int', 'StretchBlt', 'hwnd', $hDestDC, 'int', 0, 'int', 0, 'int', $W, 'int', $H, 'hwnd', $hSrcDC, 'int', 0, 'int', 0, 'int', $Width, 'int', $Height, 'dword', $SRCCOPY) Else $Res = DllCall('gdi32.dll', 'int', 'BitBlt', 'hwnd', $hDestDC, 'int', 0, 'int', 0, 'int', $W, 'int', $H, 'hwnd', $hSrcDC, 'int', Round(($Width - $W) / 2), 'int', Round(($Height - $H) / 2), 'dword', $SRCCOPY) EndIf If (@error) Or (Not $Res[0]) Then $Res = 0 Else $Res = 1 EndIf _WinAPI_ReleaseDC($hWnd, $hDC) _WinAPI_DeleteDC($hDestDC) _WinAPI_DeleteDC($hSrcDC) If Not $Res Then _WinAPI_DeleteObject($hBmp) Else _WinAPI_DeleteObject(_SendMessage($hWnd, $STM_SETIMAGE, 0, 0)) _SendMessage($hWnd, $STM_SETIMAGE, 0, $hBmp) $hObj = _SendMessage($hWnd, $STM_GETIMAGE) If $hObj <> $hBmp Then _WinAPI_DeleteObject($hBmp) EndIf EndIf Return $Res EndFunc ;==>_GUICtrlSetImage My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
AndreyS Posted November 14, 2009 Author Share Posted November 14, 2009 (edited) No simple solution but it works! Thank you very much, Yashied! Edited November 14, 2009 by AndreyS 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