clip image part into new image

Hi I am trying to clip icons form a icon spriteimage ( grid with icons)

I have a little bit shame to ask this, I should know this. :slight_smile:
Why does this not work:

  • intX and intY are set in a earlier part of the code (i.e. set to 240 and 0)
  • intIcoWidth and intIcoHeight are both set to 48
  • spriteicons is the image containing the grid with all the icons

[code] 'clip picture part into new picture
picico = new picture(intIcoWidth,intIcoHeight,32)
g = picico.graphics
g = spriteicons.Graphics.Clip(intx,inty,intIcoWidth,intIcoHeight)

'temporary show the icon to test
Canvas1.Backdrop = picico[/code]

graphics.Clip isn’t doing what you think. It’s actually creating a clipping area to draw into, where if you draw outside the area, no drawing is done. You should look at using graphics.DrawPicture to “crop” your picture.