![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Is there a reasonably easy way to find the position of a Bitmap in a PictureBox? With the PictureBox's AutoSize property set to Zoom, it doesn't seem like there would be any way to figure it out, at least without knowing the zoom factor, and even then, there doesn't seem to be anything in either the PictureBox or Bitmap class to give a hint. Does anybody have any ideas? Thanks, Lee Crabtree |
#3
| |||
| |||
|
|
My advice here would be to scrap using PB and write your own control. A reasonable PB control can be created in about 15 minutes derived from a panel or a simple control. The image position can be obtained by simple backtracking (see the GDI+ FAQ). For the basic picturebox functionality see the zoompicbox. |
#4
| |||
| |||
|
|
If it was anybody else suggesting it, I'd probably tell them to drop dead. But, as I've made use of your suggestions and information more than once, I'll give it a whirl. It's just frustrating that something that seems so important would be hidden so insidiously. Thanks, Lee Crabtree Bob Powell [MVP] wrote: My advice here would be to scrap using PB and write your own control. A reasonable PB control can be created in about 15 minutes derived from a panel or a simple control. The image position can be obtained by simple backtracking (see the GDI+ FAQ). For the basic picturebox functionality see the zoompicbox. |
#5
| |||
| |||
|
|
Well, the problem is that if you look at the PictureBox with Reflector you can see that they have a method called ImageRectangleFromSizeMode. In the paint, they just draw the image into this rectangle. The problem here is that A. they don't use transforms at-all, which would be the sensible way to do it and B. the rectangle isn't available, unless of course you fiddle in the internals with reflection. This means that picturebox retains its reputation as an utter POS and for your purposes it's next to useless. If I had the time I'd write the darned thing for you but i'm a wee bit up to my ears in work at the moment. Zoompicbox is a good start, then read that backtracking article and maybe the one on understanding autoscroll. You'll get there. |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |