incepator Posted October 26, 2014 Posted October 26, 2014 Hi guys, I am looking for a good and stable method to put a button png in a form, which have a beautiful interface, and to look like a button. Eventually, I managed to do that, just after I click on it ... Button clarity is lost. If you have a simple idea to solve this problem, I would be very happy.Thank you! expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include "GUICtrlOnHover.au3" #include <GDIPlus.au3> _GDIPlus_Startup() #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 438, 192, 124) $Button1 = GUICtrlCreatePic("", 5, 40, 40, 40) _GUICtrl_OnHoverRegister(-1, "_Hover_Proc", "_Leave_Hover_Proc", "PrimaryDown_Proc", "PrimaryUp_Proc") SendImageToPicControl("back1.png", $Button1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func SendImageToPicControl($sImage, $iCtrlID) Local Const $hImage = _GDIPlus_ImageLoadFromFile($sImage) Local Const $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _WinAPI_DeleteObject(GUICtrlSendMsg($iCtrlID, 0x0172, $IMAGE_BITMAP, $hHBitmap)) _WinAPI_DeleteObject($hHBitmap) _GDIPlus_ImageDispose($hImage) EndFunc ;==>SendImageToPicControl Func _Hover_Proc($iCtrlID) Switch $iCtrlID Case $Button1 SendImageToPicControl("back2.png", $Button1) EndSwitch EndFunc ;==>_Hover_Proc Func _Leave_Hover_Proc($iCtrlID) Switch $iCtrlID Case $Button1 SendImageToPicControl("back1.png", $Button1) EndSwitch EndFunc ;==>_Leave_Hover_Proc Func PrimaryDown_Proc($iCtrlID) Switch $iCtrlID Case $Button1 SendImageToPicControl("back3.png", $Button1) EndSwitch EndFunc ;==>PrimaryDown_Proc Func PrimaryUp_Proc($iCtrlID) Switch $iCtrlID Case $Button1 SendImageToPicControl("back2.png", $Button1) EndSwitch EndFunc ;==>PrimaryUp_Proc GUICtrlOnHover.au3
AutID Posted October 26, 2014 Posted October 26, 2014 (edited) For me it works fine. I mean it works as it should be working. I am not quite sure what your problem is. Edit: Check this out. I played with it some days ago. It might be good for your needs.'?do=embed' frameborder='0' data-embedContent>> Edited October 26, 2014 by AutID https://iblockify.wordpress.com/
incepator Posted October 26, 2014 Author Posted October 26, 2014 Before you put the cursor on the arrow, it is clear image, but after you put the cursor on the arrow, the arrow clearly is low.
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