Results 1 to 4 of 4

Thread: [resolved] Help: StretchBlt results in empty .Picture property

  1. #1

    Thread Starter
    Registered User
    Join Date
    Jul 2002
    Posts
    8

    [resolved] Help: StretchBlt results in empty .Picture property

    VB Code:
    1. Private Sub Command2_Click()
    2.  
    3.  z = 2
    4.  pic2.Height = pic1.Height / z
    5.  pic2.Width = pic1.Width / z
    6.  
    7.  
    8. For x = 0 To pic2.Width
    9.  For y = 0 To pic2.Height
    10.  
    11.  StretchBlt pic2.hdc, x, y, z, z, pic1.hdc, x * z, y * z, z, z, &HCC0020
    12.  
    13.  Next y
    14. Next x
    15.  
    16.  pic2.Refresh
    17.  Clipboard.SetData pic2.Picture
    18.  
    19. End Sub

    What the code above does is first resize the picturebox pic2 to be half the size of pic1, then copy the picture from pic1 to pic2 at half size. I use the for next loop rather than one StretchBlt because it yields better looking results.

    My problem is when I want to copy the resulting picture to the clipboard pic2.Picture = 0. I don't think I full understand what StretchBlt is doing with the picture and/or video memory. Is there a way I can copy the result in pic2 to the clipboard.

    any suggestions?

    thanks
    Last edited by BeerBaron; Jul 7th, 2002 at 09:16 PM.

  2. #2
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    VB Code:
    1. Private Sub Command2_Click()
    2.     z = 2
    3.     pic2.Height = pic1.Height / z
    4.     pic2.Width = pic1.Width / z
    5.     For x = 0 To pic2.Width
    6.         For y = 0 To pic2.Height
    7.             StretchBlt pic2.hdc, x, y, z, z, pic1.hdc, x * z, y * z, z, z, &HCC0020
    8.         Next y
    9.     Next x
    10.     pic2.Refresh
    11.     Clipboard.SetData pic2.[b]Image[/b]
    12. End Sub


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

  3. #3

    Thread Starter
    Registered User
    Join Date
    Jul 2002
    Posts
    8
    son of a ***** it worked! thanks a lot!

    so what is the difference between the .picture and the .image properties?

  4. #4
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    Picture specifies the Picture FILE currently under display. It only specifies the picture loaded from a file and doesn't give you anything painted on the picturebox while Image does.

    BTW, you really need to cut down on the swearing, especially if you are helped. Many people on the forums would get annoyed at your attitude and leave.


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width