Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Func _ChooseIcon($fFileName = "")
- Local $_CI_IconCount, $_CI_FileName, $_CI_SelectedIconName, $_CI_IconRadios[30], $_CI_Labels[30],$_CI_NewFile
- Local $_CI_oldEventMode = Opt("GuiOnEventMode",0)
- Local $_CI_StartIndex = 1
- Local $arTemp[2]
- If FileExists($fFileName) Then
- Local $_CI_FileName = $fFileName
- Else
- Local $_CI_FileName = @SystemDir & "\shell32.dll"
- EndIf
- Local $_CI_hGui=GUICreate("Choose Icon:", 385, 450, -1, -1, -1, $WS_EX_ACCEPTFILES)
- GUICtrlCreateGroup("", 5, 1, 375, 40)
- GUICtrlCreateGroup("", 5, 50, 375, 350)
- Local $_CI_hFile = GUICtrlCreateInput($_CI_FileName, 12, 15, 325, 16, -1, $WS_EX_STATICEDGE)
- GUICtrlSetState(-1, $GUI_DROPACCEPTED)
- GUICtrlSetTip(-1, "You can drop files from shell here...")
- Local $_CI_hStatus = GUICtrlCreateInput("", 90, 49, 200, 16, $ES_READONLY, $WS_EX_STATICEDGE)
- Local $_CI_hFileSel = GUICtrlCreateButton("...", 345, 14, 26, 18)
- Local $_CI_Next = GUICtrlCreateButton("&Weiter -|>",310,410)
- Local $_CI_Back = GUICtrlCreateButton("<|- &Zurück",20,410)
- Local $_CI_OK = GUICtrlCreateButton("Icon wählen:",120,410)
- GUICtrlSetState(-1,$GUI_DISABLE)
- Local $_CI_Icon = GUICtrlCreateIcon("",0,190,404,32,32)
- For $iCntRow = 0 to 4
- For $iCntCol = 0 to 5
- $iCurIndex = $iCntRow * 6 + $iCntCol
- $_CI_IconRadios[$iCurIndex] = GUICtrlCreateRadio("", 55 * $iCntCol + 25, 65 * $iCntRow + 75, 45, 45,$BS_ICON+$BS_PUSHLIKE)
- $_CI_Labels[$iCurIndex] = GUICtrlCreateLabel("1", 55 * $iCntCol+12, 65 * $iCntRow + 120, 58, 20, $SS_CENTER)
- GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT )
- Next
- Next
- _CI_NewFileLoad($_CI_FileName,$_CI_IconCount, $_CI_hFile)
- _CI_Update($_CI_IconRadios, $_CI_Labels, $_CI_hStatus, $_CI_StartIndex, $_CI_IconCount, $_CI_FileName, $_CI_SelectedIconName)
- GUISetState () ; will display an dialog box with 1 checkbox
- ; Run the GUI until the dialog is closed
- While 1
- $gMsg = GUIGetMsg()
- Switch $gMsg
- Case $_CI_IconRadios[0] To $_CI_IconRadios[29]
- For $i = 0 To 29
- If GUICtrlRead($_CI_IconRadios[$i]) = $GUI_CHECKED Then
- $_CI_SelectedIconName = 1*GUICtrlRead($_CI_Labels[$i])
- GUICtrlSetImage($_CI_Icon,$_CI_FileName,$_CI_SelectedIconName)
- GUICtrlSetState($_CI_OK,$GUI_ENABLE)
- ExitLoop
- EndIf
- Next
- Case $_CI_hFileSel
- $_CI_NewFile = _CI_NewFileLoad( _
- FileOpenDialog("Select Icon file:", GUICtrlRead($_CI_hFile), "Icon-Files (*.exe;*.dll;*.ocx;*.icl;*.ico)") _
- ,$_CI_IconCount, $_CI_hFile)
- If Not ($_CI_NewFile == -1) Then
- $_CI_FileName = $_CI_NewFile
- GUICtrlSetState($_CI_Back,$GUI_DISABLE)
- GUICtrlSetState($_CI_OK,$GUI_DISABLE)
- $_CI_StartIndex = 1
- $_CI_SelectedIconName = 0
- GUICtrlSetImage($_CI_Icon,"")
- _CI_Update($_CI_IconRadios, $_CI_Labels, $_CI_hStatus, $_CI_StartIndex, $_CI_IconCount, $_CI_FileName, $_CI_SelectedIconName)
- EndIf
- Case $_CI_Back
- If $_CI_StartIndex - 30 >= 0 Then $_CI_StartIndex -= 30
- If $_CI_StartIndex - 30 < 0 Then
- GUICtrlSetState($_CI_Back,$GUI_DISABLE)
- EndIf
- GUICtrlSetState($_CI_Next,$GUI_ENABLE)
- _CI_Update($_CI_IconRadios, $_CI_Labels, $_CI_hStatus, $_CI_StartIndex, $_CI_IconCount, $_CI_FileName, $_CI_SelectedIconName)
- Case $_CI_Next
- If $_CI_StartIndex + 30 <= $_CI_IconCount Then $_CI_StartIndex += 30
- If $_CI_StartIndex + 30 > $_CI_IconCount Then
- GUICtrlSetState($_CI_Next,$GUI_DISABLE)
- EndIf
- GUICtrlSetState($_CI_Back,$GUI_ENABLE)
- _CI_Update($_CI_IconRadios, $_CI_Labels, $_CI_hStatus, $_CI_StartIndex, $_CI_IconCount, $_CI_FileName, $_CI_SelectedIconName)
- Case $GUI_EVENT_CLOSE
- SetError(1)
- ExitLoop
- Case $_CI_OK
- Local $arTemp[2] = [$_CI_FileName,$_CI_SelectedIconName]
- ExitLoop
- EndSwitch
- Wend
- GUIDelete($_CI_hGui)
- Opt("GuiOnEventMode",$_CI_oldEventMode)
- Return $arTemp
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement