Page 1 of 1

Bitmap size of dcmenuitem

Posted: Wed Jul 02, 2014 6:47 am
by Wolfgang Ciriack
Hello Roger,
is there a possibility to set the size of the bitmap from a DCMENUITEM if the bitmap resource is an icon ?
You see in this picture, that they are loaded in a to big size.

Re: Bitmap size of dcmenuitem

Posted: Wed Jul 02, 2014 7:11 am
by Auge_Ohr
Menue Bitmap must be 16x16.
look into Source of DCMENUITEM -> c:\exp19\Source\Dclipx\_dcclass.prg

Code: Select all

  oBmp := ::ItemImages[aInfo[1]]

   IF oBmp != NIL .AND. ::bitmaps
      nY := ((aInfo[4][4] - 1 - aInfo[4][2]) - oBmp:ySize) /2
      IF oBmp:isDerivedFrom('XbpIcon')
        nY += aInfo[4][2]+3
        x := aInfo[4][1] + ::BarWidth + ITEM_SPACING *2
        y := nY
        oBmp:draw( oPS, { x, y, x + 22, y + 22 } )
      ELSE
        nY += aInfo[4][2]
        oBmp:draw( oPS, {aInfo[4][1] + ::BarWidth + ITEM_SPACING *2,nY} )
      ENDIF
   ENDIF

Re: Bitmap size of dcmenuitem

Posted: Wed Jul 02, 2014 7:51 am
by rdonnay
Try this:

oIcon := XbpIcon():new():create()
oIcon:loadFile('myicon.ico',16,16)

DCMENUITEM 'My Menu Item' ICONS {oIcon}

Re: Bitmap size of dcmenuitem

Posted: Wed Jul 02, 2014 12:10 pm
by Wolfgang Ciriack
Thanks, i will try that.