PictureBox assignments 
Author Message
 PictureBox assignments

Hi everybody

    In any examples at the end of pixel manipulations, I have noted this
assignment:

        <PctureBox>.Picture = <PictureBox>.Image

It is really necessary? The code works the same correctly!

    I thank all the group in advance,

        Andrea.-



Wed, 02 Mar 2005 01:39:50 GMT  
 PictureBox assignments

Quote:
>     In any examples at the end of pixel manipulations, I have noted this
> assignment:

>         <PctureBox>.Picture = <PictureBox>.Image

> It is really necessary? The code works the same correctly!

What this does is to 'lock' the picture box's picture to the background
image (So to speak).
Try this:

'***
With Picture1
    .AutoRedraw = True

    'Display the form
    Form1.Show
    DoEvents

    'Draw rectangle
    Picture1.Line (0, 0)-(1000, 1400), vbGreen, BF
    MsgBox "Rectangle drawn"
    .Cls 'Clear to background
    MsgBox "Without .Picture = .Image"

    'Draw rectangle
    Picture1.Line (0, 0)-(1000, 1400), vbGreen, BF
    .Picture = .Image
    MsgBox "Rectangle drawn and locked"
    .Cls 'Clear to background
    MsgBox "With .Picture = .Image"
End With
'***

The first rectangle is drawn but not locked then when .Cls is called it is
lost.  The second rectangle is drawn and locked then when .Cls if called we
see that the rectangle has been locked to the 'background' graphic.
This shows that a picture box actually has multiple images stored within it
which is why it's very memory intensive, especially when set to AutoRedraw.
If you don't need to lock the background image then you don't have to, in
some cases though it's very useful.
Hope this helps,

    Mike

 -- EDais --

 - Microsoft Visual Basic MVP -
WWW: Http://EDais.earlsoft.co.uk/




Wed, 02 Mar 2005 01:57:26 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Adding an assignment and a resource to this assignment

2. Help!! Loading PictureBox FromStream and PictureBox.Image.Save

3. Best way to preview a font in a PictureBox (WAS: Question on Picturebox or an alternative)

4. copying a modified picturebox into a new picturebox

5. Copy picturebox to another picturebox

6. PictureBox inside PictureBox...

7. Best way to preview a font in a PictureBox (WAS: Question on Picturebox or an alternative)

8. copying offscreen picturebox to another picturebox

9. Best way to preview a font in a PictureBox (WAS: Question on Picturebox or an alternative)

10. Problem with assignment statement

11. type mismatch in recordset assignment

12. printer assignment

 

 
Powered by phpBB® Forum Software