Jump to content

Gui Elemanını Fare Üzerindeyken Büyültmek Vs.vs...


blue_life
 Share

Recommended Posts

Aslında bunun için bir çok örnek verilebilir. Ben bu gün farklı bir örnek vermek istiyorum. Lakin farklı sistemlerde sorunsuz çalışmırmı denemek lazım :)
Hazırladğım örneği ve ilgili resimleri aşağıdaki linkten indirebilirsiniz.

:download1:
[color="#0000FF"][u]http://bluelife.zxq.net/Files/Autoit/Samples/Button_Animate_Test.zip[/u][/color]

Kullandığım free ftpdeki sorunlara karşı, kodlarımızı burdan da verelim.
[codebox]Global $Total_Button = 2
Global $Buttons[$Total_Button + 1][7] = [[$Total_Button, 0], _ ;nid, nhwnd, x_pos, y_pos, w_pos,h_pos
["", "", 50, 40, 64, 64, "_Button_1"], _ ;Button_1
["", "", 120, 40, 64, 64, "_Button_2"]] ;Button_2

Local $Form1 = GUICreate("BlueLife Button Test", 230, 150)
GUISetBkColor(0x0000FF) ;Beyaz

$Buttons[1][0] = GUICtrlCreatePic("Turkey.bmp", $Buttons[1][2], $Buttons[1][3], $Buttons[1][4], $Buttons[1][5])
$Buttons[1][1] = GUICtrlGetHandle(-1); Handlesini alıyoruz

$Buttons[2][0] = GUICtrlCreatePic("Close.bmp", $Buttons[2][2], $Buttons[2][3], $Buttons[2][4], $Buttons[2][5])
$Buttons[2][1] = GUICtrlGetHandle(-1); Handlesini alıyoruz

GUIRegisterMsg(32, "_Blue_Button_Animation")
GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
Exit
EndSwitch
WEnd

Func _Button_1()
MsgBox(64, "BlueLife", "Ne Mutlu Türküm Diyene!")
EndFunc ;==>_Button_1

Func _Button_2()
MsgBox(64, "BlueLife", "Bye bye!")
Exit
EndFunc ;==>_Button_2

Func _Blue_Button_Animation($hWnd, $Msg, $wParam, $lParam)
Local $GID = $Buttons[0][1]

If $GID = $wParam Then
$GID = $Buttons[0][2]

Switch BitShift($lParam, 16)
Case 512
;Contiune
Case 513
GUICtrlSetPos($Buttons[$GID][0], $Buttons[$GID][2] + 0.5, $Buttons[$GID][3] + 0.5, $Buttons[$GID][4] + 1, $Buttons[$GID][5] + 1)
Case 514
GUICtrlSetPos($Buttons[$GID][0], $Buttons[$GID][2] - 0.5, $Buttons[$GID][3] - 0.5, $Buttons[$GID][4] + 1, $Buttons[$GID][5] + 1)
Call($Buttons[$GID][6])
EndSwitch

Else
If $GID <> 0 Then
$GID = $Buttons[0][2]
GUICtrlSetPos($Buttons[$GID][0], $Buttons[$GID][2], $Buttons[$GID][3], $Buttons[$GID][4], $Buttons[$GID][5])
$Buttons[0][1] = 0
EndIf

For $GID = 1 To $Buttons[0][0]
If $wParam = $Buttons[$GID][1] Then
GUICtrlSetPos($Buttons[$GID][0], $Buttons[$GID][2] - 0.5, $Buttons[$GID][3] - 0.5, $Buttons[$GID][4] + 1, $Buttons[$GID][5] + 1)
$Buttons[0][1] = $Buttons[$GID][1]
$Buttons[0][2] = $GID
ExitLoop
EndIf
Next

EndIf
EndFunc ;==>_BlueButtonAnimation[/codebox]

Neyse umarım faydalı bir örnek olmuştur. Çalışmalarınızda başarılar dilerim arkadaşlar, kolay gelsin...

Link to comment
Share on other sites

  • 2 hafta sonra ...

@MeHMeTBeN

Png için udfler kullanmak gerekiyordu. Yani üzerinde uğraşılması gereken bir konu :( Şuan için buna malesef vakit ayıramam...
Eğer arkaplanı sabit bir renk olarak kullanacaksan, png formatını bmpye dönüştürmeden önce arkaplanı ilgili renk ile doldur.
Tasarımda fazla anlamıyorum ama photoshopta çok basit bir işlemdi...

Link to comment
Share on other sites

Bu icons.au3 le baya bişeyler yapılabiliyo.
[code]http://www.autoitscript.com/forum/index.php?app=core&module=attach&section=attach&attach_id=26442[/code]
ama ben udf kullanmıyorum png için, _gdiplus fonksiyonları gayet yeterli bu durumlarda.

Ha bir de benim kullandığım metodu vereyim basit bir metoddur. Gui elemanının üstüne gelince farklı, basınca farklı ve terkettiğinizde farklı bir yazı çıkarabilirsiniz veya resim koyabilirsiniz vs. ;)

[codebox]Global $onceki

$hgui = GUICreate("deneme",500,500)
$b = GUICtrlCreateButton("deneme",10,20)
$d = GUICtrlCreatePic("Z:\BlackXP\Resimlerim\TnC\TnC (15).jpg",10,100,20,20)
$e = GUICtrlCreateLabel("buraya yaz",10,150,300,30)
GUISetState()

While 1
$nm = GUIGetMsg()
Switch $nm
Case -3
Exit
Case $b
GUICtrlSetData($e,"buton")
Case $d
GUICtrlSetData($e,"pic")
Case $e
GUICtrlSetData($e,"label")
EndSwitch
$m = GUIGetCursorInfo($hgui)
if $m[4] <> $onceki Then
Switch $m[4]
Case $b
GUICtrlSetData($e,"buton3")
Case $d
GUICtrlSetData($e,"pic3")
Case $e
GUICtrlSetData($e,"label3")
Case Else
GUICtrlSetData($e,"orjinal")
EndSwitch
$onceki = $m[4]
EndIf
WEnd[/codebox]

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...