hi,
what Type is your Image, BMP or ICO ?
i did not have that Problem with HX_Class as you can see Attachment
- CJ_PushButton.jpg (15.3 KiB) Viewed 34655 times
i did have a look into old XCodejock Code and saw
Code: Select all
STATIC FUNCTION _ButtonBlock( i, aDir, nOffset )
RETURN {|o,b|o:caption := 'Appearance ' + Alltrim(Str(i)), ;
o:appearance := i, ;
b := DC_GetBitmap('..\..\..\bitmaps\' + aDir[i+nOffset,1]), ;
b:transparentClr := AutomationTranslateColor(b:transparentClr,.f.), ;
o:picture := b:getIPicture(), ;
o:imageGap := 20, ;
o:click := {|a,b,o|MsgBox('button ' + Alltrim(str(i)))}}
as i can see, this Function use DC_GetBitmap() and use o:
picture
but there is also a
Icon Property which need ImageManagerIcon.
Code: Select all
VAR Icon // Xbase++ NEW
VAR x_Icon2
ASSIGN METHOD _IPicture() VAR x_Icon2
...
METHOD HX_Button:Create(...)
//
// ImageManagerIcon as XbpActiveXControl
//
::oImgList := XbpActiveXControl():new(,, {0,0}, {0,0} )
::oImgList:CLSID := "Codejock.ImageManager"+HX_VERSION()
::oImgList:create()
IF ::Icon == NIL
::Icon := "DUMMY.ICO"
ENDIF
IF ::Caption == NIL
::Caption := ""
ENDIF
IF ::preSelect == NIL
::preSelect := .F.
ENDIF
//
// after create ?!
//
// ASSIGN METHOD "transfer" data
//
::x_Icon2 := ::Icon
::x_Caption := ::Caption
::x_Default := ::preSelect
::UseVisualStyle := .T.
//
// set Presentation Parameter to activeX
//
IF .NOT. EMPTY(::aPres)
HX_PresPara(self)
ENDIF
//
//
//
::Show()
RETURN self
METHOD HX_Button:_IPicture(xValue) // COM iPicture
LOCAL lOkValue := .T.
LOCAL oLogo
LOCAL oPicture
LOCAL oIco
LOCAL lIco := .T.
LOCAL nHandle
LOCAL oIcons
LOCAL nResource
LOCAL nCommand
IF PCOUNT() > 0
IF ::nIcons <= 0
::nIcons := 1
ELSE
::nIcons++
ENDIF
IF VALTYPE(xValue) = "C" // STRING
DO CASE
CASE ".BMP" $ UPPER(xValue)
::oImgList:Icons:LoadBitmap(xValue,::nIcons,xtpImageNormal)
lIco := .F.
CASE ".ICO" $ UPPER(xValue)
::oImgList:Icons:LoadIcon (xValue,::nIcons,xtpImageNormal)
OTHERWISE
lOkValue := .F.
ENDCASE
ELSEIF VALTYPE(xValue) = "N" // Resoure ID
oIco := HX_Icon():new():create()
oIco:load( ::cResDLL, xValue )
IF NIL = oIco
ELSE
::setproperty("Picture", oIco:getIPicture() )
::nIcons++
ENDIF
RETURN self
ELSE
lOkValue := .F.
ENDIF
IF ::oImgList:Icons:Count() == 0
MSGBOX("Icons "+LTRIM(STR(::oImgList:Icons:Count()))+" can not continue")
ELSE
IF lOkValue == .T.
oIco := ::oImgList:Icons:GetImage(::nIcons,32)
::setproperty("Icon" , oIco )
::nIcons++
ENDIF
ENDIF
ENDIF
RETURN self
as i can say,
BMP have to be use ImageManagerIcon assing to Property
Icon
while
ICO have to load with XbpIcon() and use with Property
Picture