Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

FieroAddict

(VB) BltBlit woes...

This topic is 6056 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

    
Option Explicit

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

Private Sub Command1_Click()
    BitBlt Front.hDC, 32, 32, 32, 32, LinkSprite.hDC, 32, 32, vbSrcCopy
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeySpace Then
        BitBlt Front.hDC, 32, 32, 32, 32, LinkSprite.hDC, 32, 32, vbSrcCopy
    End If
End Sub

Private Sub Form_Load()
    BitBlt Front.hDC, 32, 32, 32, 32, LinkSprite.hDC, 32, 32, vbSrcCopy
End Sub
 
This is the code from my test form. I'm just simply blitting a sprite from Zelda (hence the name of my PictureBox "LinkSprite"). The problem is that, the BitBlt code only works when called from a command button or a subroutine called from the command button routine. Any other time I try to call the BltBit function, it just does nothing. And if I delete the command button from my form and call BltBit from the Form_Load routine, the form disappears! Any insight to my problem would be greatly appreciated. Thanks. Edited by - FieroAddict on November 19, 2001 9:00:44 PM

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Dude, put your code between source tags ([ source] and [ /source], but without the spaces). That was WAY too hard to read on this tiny monitor.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Hmm... I dunno, it seems to work for me.
I assumed that "Front" and "LinkSprite" are PictureBox controls, when I tried to emulate your program (or at least, this little part of it).
If this isn''t the case, I''ll need more details.
If it is, try this:
Make sure that you have the proper scalemodes set up for both boxes (3 - pixels).
Make sure you have "AutoRedraw" set to true for them both also.
I had to do those two things to get it to work.

Share this post


Link to post
Share on other sites
*smacks self in head* I was forgeting the auto-redraw on the main picture box. (Front ) (Sorry I left out a couple details about the picture boxes.) Figures it was something easy.

Thank you.

Share this post


Link to post
Share on other sites
I''ve been a member of Pennock''s Fiero Forum for over a year now. Check it out if you haven''t already. My SN over there is ''btoth''. http://www.fieroforum.com/ Great place to just hang out and chat.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!