Jump to content

Butona Icon Atama


Mehmet
 Share

Recommended Posts

[b]böyleyken sorun yok[/b]
[codebox]
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 154, 124)
$Button1 = GUICtrlCreateButton("", 40, 24, 65, 57, $BS_ICON)
GUICtrlSetImage(-1, "C:\Documents and Settings\UXP\Desktop\speaker.ico", -1)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
[/codebox]

[b]ama fileinstall ile tempden çekince olmuyor nerde hatam var forumda aradım ams ile ilgili çıkıyor bir türlü bulamadım[/b] :)
[codebox]
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 154, 124)
DirCreate(@TempDir & "\Deneme")
FileInstall("speaker.ico",@TempDir & "\Deneme\speaker.ico",1)
$Button1 = GUICtrlCreateButton("", 40, 24, 65, 57, $BS_ICON)
GUICtrlSetImage(@TempDir & "\Deneme\speaker.ico", -1)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
DirRemove(@TempDir & "\Deneme" ,1)
Exit
EndSwitch
WEnd
[/codebox]

Edited by MeHMeTBeN
Link to comment
Share on other sites

icon ismini değiştirip ikinci bir butona atadığımdada aynı uzantıyı alıyor
$Button2 = GUICtrlCreateButton("", 264, 72, 105, 81, $BS_ICON)
GUICtrlSetImage(-1, "C:\Documents and Settings\UXP\Desktop\cspeaker.ico", -1)
:)

birde o kısmı sürekli değiştirmekmi gerekiyor yoksa kodada bir ayarı varmı onun

Link to comment
Share on other sites

@MeHMeTBeN

Ne demek istediğini tam anlayamadım malesef :(
GUICtrlSetImage hakkında yardım dosyasına gözat. Son kısımdaki -1 ne oluyor!

Senin verdiğin ikinci örnekte; ([b]GUICtrlSetImage(@TempDir & "\Deneme\speaker.ico", -1)[/b]) ilk önce icon doysasını yazmışsın. Ilk önce gui elemanının idini yazmalıydın...

GUICtrlSetImage(@TempDir & "\Deneme\speaker.ico", -1)[b][color="#FF0000"] -->[/color][/b] GUICtrlSetImage(-1,@TempDir & "\Deneme\speaker.ico") olacaktı.
Yada -1 yerine $Button1 da yazabilirsin. Yani GUICtrlSetImage($Button1,@TempDir & "\Deneme\speaker.ico",0)

Daha önce yazdığım üzer GUICtrlSetImage hakkında yardım dosyasına gözatmalısın!

Link to comment
Share on other sites

Üstadımın dediği gibi controlid olarak -1 yerine değişkenin kendisini yazabilirsin.
[code]
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 154, 124)
DirCreate(@TempDir & "\Deneme")
FileInstall("speaker.ico",@TempDir & "\Deneme\speaker.ico",1)
$Button1 = GUICtrlCreateButton("", 40, 24, 65, 57, $BS_ICON)
GUICtrlSetImage($Button1, @TempDir & "\Deneme\speaker.ico")
$Button2 = GUICtrlCreateButton("", 264, 72, 105, 81, $BS_ICON)
GUICtrlSetImage($Button2, "C:\Documents and Settings\UXP\Desktop\cspeaker.ico")
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
DirRemove(@TempDir & "\Deneme" ,1)
Exit
EndSwitch
WEnd
[/code]

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...