按钮控件button改变景颜色和多行文体和显示图标三者不能同时有效
本帖最后由 txxdhnt 于 2012-8-17 21:33 编辑按钮控件button改变景颜色和多行文体和显示图标三者不能同时有效。
#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>
Opt("MustDeclareVars", 1)
_Main()
Func _Main()
Local $hImage, $y = 70, $iIcon = 125, $btn, $rdo, $chk, $hImageSmall
GUICreate("Buttons", 1028, 600)
GUISetState()
$hImage = _GUIImageList_Create(32, 32, 5, 3, 6)
For $x = 6 To 11
_GUIImageList_AddIcon($hImage, "shell32.dll", $x, True)
Next
$btn = GUICtrlCreateButton("Button1", 10, 10, 90, 50)
_GUICtrlButton_SetImageList($btn, $hImage)
Local $btnTitel="买入"&@CRLF&"600583"&@CRLF&"海油工程"&@CRLF&"5.78元"&@CRLF &"3%"&@CRLF &"1300"&@CRLF
For $x = 5 To 5
$btn[$x] = GUICtrlCreateButton( $btnTitel, 10, $y, 100, 100,$BS_MULTILINE)
GUICtrlSetStyle(-1, BitOR($BS_MULTILINE,$BS_BITMAP))
; GUICtrlSetBkColor($btn[$x], $GUI_BKCOLOR_TRANSPARENT )
;_GUICtrlButton_SetImageList($btn[$x], _GetImageListHandle(@ScriptDir&"\gray_buy_1.bmp", $iIcon + $x, True), 5)
_GUICtrlButton_SetImageList($btn[$x], $hImage)
$y += 100
; GUICtrlSetBkColor($btn[$x], 0xA0A0A4)
GUICtrlSetColor($btn[$x], 0xff0000)
GUICtrlSetStyle($btn[$x], BitOR($BS_MULTILINE,$BS_BITMAP))
Next
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
WEnd
Exit
EndFunc ;==>_Main
; using image list to set 1 image and have text on button
Func _GetImageListHandle($sFile, $nIconID = 0, $fLarge = False)
Local $iSize = 16
If $fLarge Then $iSize = 32
Local $hImage = _GUIImageList_Create(30, 100, 5, 3)
If StringUpper(StringMid($sFile, StringLen($sFile) - 2)) = "BMP" Then
_GUIImageList_AddBitmap($hImage, $sFile)
Else
_GUIImageList_AddIcon($hImage, $sFile, $nIconID, $fLarge)
EndIf
Return $hImage
EndFunc ;==>_GetImageListHandle 这看着已经不像Button了 这看着已经不像Button了 取button句柄,gdi画
页:
[1]