Results 1 to 12 of 12

Thread: [RESOLVED] Is it possible to use IpictureDisp with BitBlt?

Threaded View

  1. #1

    Thread Starter
    Lively Member VBNubcake's Avatar
    Join Date
    Feb 2008
    Location
    Caledon, Ontario, Canada
    Posts
    80

    Resolved [RESOLVED] Is it possible to use IpictureDisp with BitBlt?

    Is it possible to use an IpictureDisp variable with BitBlt?

    This is in module:
    Code:
    'Enable BitBlt
    Public Declare Function BitBlt Lib "gdi32.dll" _
        (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
    This is in form:
    Code:
    Dim pic As IPictureDisp
    
    Private Sub Command1_Click()
    Form1.AutoRedraw = True
    Picture1.AutoRedraw = True
    Set pic = LoadPicture("D:\Alejandro\VB Programs\RPG\Sprites and Bitmaps\Enemies\dim master.gif")
    picture1.cls
    BitBlt Picture1.hDC, 0, 0, pic.Width, pic.Height, pic.Handle, 0, 0, vbSrcCopy
    End Sub

    I'm not too sure if pic.Handle is supposed to be used here...

    But essentially, I just want to use bitblt (or any similar function for that matter) without having to keep track of the pixel dimensions of the source image. Cause im trying to create animations (multiple pictures) and for each picture I have to keep track of the exact dimension of each picture so it blts properly, for example this is what i want to avoid:

    Code:
    Const DimMasterWidth = 119
    Const DimMasterHeight = 153
    
    picture1.cls
    BitBlt Picture1.hDC, 0, 0, DimMasterWidth, DimMasterHeight, picSource.hDC, 0, 0, vbSrcCopy

    I wanna be able to load the pictures into the program at the beginning of runtime and i want vb to automatically keep track of the dimensions through Pic.Width and Pic.Height or something along those lines. Essentially, i dont wanna have to type in:
    Code:
    Const DimMasterWidth = 119
    Const DimMasterHeight = 153
    because i have ALOT of pictures (hundreds), and its alot of tedious work (and i think unnecessary).

    Any suggestions? I'm open to new functions as well, anything at all. I've tried Pic.Render instead of BitBlt except i cant seem to keep the scale size the same (reply if you wanna see my code for that method).

    Help plz
    Last edited by VBNubcake; Apr 24th, 2008 at 09:01 AM.

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