N
nvx
Hello,
I experience a strange problem with PictureBox I draw onto. My
application has a fill-docked TabControl on its form and there is
PictureBox on one of the TabPages. If I resize the form (hence the
PictureBox should resize too) WITHOUT switching to the TabPage
containing the PictureBox before drawing onto it, the PictureBox does
not change its dimensions and the Bitmap of the size of PictureBox I
create before drawing has wrong dimensions as well. After switching to
the TabPage containing the PictureBox the image drawn before just
stretches/shrinks depending on whether I have enlarged or made the
form smaller.
An example:
1. At this point the PictureBox is 800x600 pixels and is placed on a
TabPage which is not selected.
2. We resize the form (maximize it) and the PictureBox should now be
approx. 1000x720 pixels.
3. Now we draw something onto the PictureBox: we take its dimensions,
which are according to PB's properties STILL 800x600 (!!!), create a
Bitmap and draw what we want. After that we flush the bitmap onto the
graphics using graphics.DrawImageUnscaled(...). IT IS CLEAR THAT THE
IMAGE WE HAVE DRAWN HAS WRONG DIMENSIONS, BUT HOW TO ENSURE THE
PICTUREBOX CHANGES ITS DIMENSIONS EVEN IF IT IS NOT VISIBLE?
4. After selecting the TabPage with PictureBox the image is
stretched...
Well, is there a way to "invoke" the Resize of PictureBox / to force
it to correct its dimensions according to dimensions of its parent
control and current dock style?
Thanks a lot for any help...
Best regards
nvx
I experience a strange problem with PictureBox I draw onto. My
application has a fill-docked TabControl on its form and there is
PictureBox on one of the TabPages. If I resize the form (hence the
PictureBox should resize too) WITHOUT switching to the TabPage
containing the PictureBox before drawing onto it, the PictureBox does
not change its dimensions and the Bitmap of the size of PictureBox I
create before drawing has wrong dimensions as well. After switching to
the TabPage containing the PictureBox the image drawn before just
stretches/shrinks depending on whether I have enlarged or made the
form smaller.
An example:
1. At this point the PictureBox is 800x600 pixels and is placed on a
TabPage which is not selected.
2. We resize the form (maximize it) and the PictureBox should now be
approx. 1000x720 pixels.
3. Now we draw something onto the PictureBox: we take its dimensions,
which are according to PB's properties STILL 800x600 (!!!), create a
Bitmap and draw what we want. After that we flush the bitmap onto the
graphics using graphics.DrawImageUnscaled(...). IT IS CLEAR THAT THE
IMAGE WE HAVE DRAWN HAS WRONG DIMENSIONS, BUT HOW TO ENSURE THE
PICTUREBOX CHANGES ITS DIMENSIONS EVEN IF IT IS NOT VISIBLE?
4. After selecting the TabPage with PictureBox the image is
stretched...
Well, is there a way to "invoke" the Resize of PictureBox / to force
it to correct its dimensions according to dimensions of its parent
control and current dock style?
Thanks a lot for any help...
Best regards
nvx