Results 1 to 2 of 2

Thread: Need help with PictureBox

  1. #1
    DewGamble
    Guest

    Need help with PictureBox

    I want to add a picture together at runtime.
    Pic1
    Pic2
    Pic3

    Bottom half of Pic1 + Pic2 + Top half of Pic 3
    so it would be

    buttomhalf(Pic1)
    Pic2
    tophalf(pic3)

    How can I do this

  2. #2
    Frenzied Member Rick Bull's Avatar
    Join Date
    Apr 2002
    Location
    England
    Posts
    1,444
    I haven't tested this, or even checked over it properly but something like this would add the pictures to a picture box name Picture4. It could be more effecient though:

    VB Code:
    1. Option Explicit
    2.  
    3. Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
    4.  
    5. Private Sub MergePics()
    6.     Picture4.Cls
    7.     Call BitBlt(Picture4.hDC, 0, 0, _
    8.         Picture1.ScaleWidth / Screen.TwipsPerPixelX, _
    9.         (Picture1.ScaleHeight / Screen.TwipsPerPixelY) / 2, _
    10.         Picture1.hDC, Picture1.ScaleWidth / Screen.TwipsPerPixelX, _
    11.         Picture1.ScaleHeight / Screen.TwipsPerPixelY, vbSrcCopy)
    12.     Call BitBlt(Picture4.hDC, 0, Picture1.ScaleHeight / Screen.TwipsPerPixelY, _
    13.         Picture2.ScaleWidth, Picture2.ScaleHeight / Screen.TwipsPerPixelY, _
    14.         Picture2.hDC, 0, 0, vbSrcCopy)
    15.     Call BitBlt(Picture4.hDC, 0, _
    16.         (Picture2.ScaleHeight / Screen.TwipsPerPixelY) + _
    17.         ((Picture1.ScaleHeight / Screen.TwipsPerPixelY) / 2), _
    18.         Picture3.ScaleWidth / Screen.TwipsPerPixelX, _
    19.         (Picture3.ScaleHeight / Screen.TwipsPerPixelY) / 2, _
    20.         Picture3.hDC, 0, 0, vbSrcCopy)
    21.     If Picture4.AutoRedraw Then Picture4.Refresh
    22. End Sub

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