C# picturebox load image with an offset

后端 未结 4 1148
时光取名叫无心
时光取名叫无心 2020-12-19 14:32

I have a resource file (in .png format) which contain several images. They are sized and spaced in a way to where they should be relatively easy to call based on their offse

4条回答
  •  [愿得一人]
    2020-12-19 15:24

    It sounds like you're tring to do something like sprites; where you have just one image loaded and then move the "view port" around to show different images.

    If that's the case, you won't be able to do this with the stock PictureBox class. You can control the sizing, but not the positioning. I think what you'd have to do is load the image, via code, and create new images based off the necessary portion of that image (using GDI+).

提交回复
热议问题