Chat LIVE With Programming Experts! There Are 23 Online Right Now...

Welcome to Dream.In.Code
Become a VB Expert!

Join 244,284 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,010 people online right now. Registration is fast and FREE... Join Now!




Load Bitmap in form?

 
Reply to this topicStart new topic

Load Bitmap in form?

Jonathan Malott
13 Oct, 2008 - 12:12 PM
Post #1

D.I.C Head
**

Joined: 2 Oct, 2008
Posts: 63


My Contributions
Does anyone know how to load a bitmap in a form. I'm programming a map using mapwin and im trying to get it into my form. Ive tried setting it as a background image, but that didn't get me to where i needed to be. Please help.

User is offlineProfile CardPM
+Quote Post


jaakko
RE: Load Bitmap In Form?
13 Oct, 2008 - 01:38 PM
Post #2

New D.I.C Head
*

Joined: 26 Sep, 2008
Posts: 21



Thanked: 4 times
My Contributions
QUOTE(Jonathan Malott @ 13 Oct, 2008 - 01:12 PM) *

Does anyone know how to load a bitmap in a form. I'm programming a map using mapwin and im trying to get it into my form. Ive tried setting it as a background image, but that didn't get me to where i needed to be. Please help.



When you have a form, make a PictureBox of the size you want your picture to be. Then go to the Properties and Picture and you can browse and select your bitmap.
User is offlineProfile CardPM
+Quote Post

Jonathan Malott
RE: Load Bitmap In Form?
13 Oct, 2008 - 02:38 PM
Post #3

D.I.C Head
**

Joined: 2 Oct, 2008
Posts: 63


My Contributions
Any idea how to make a bitmap a sprite and then make it move about the screen in even increments?
User is offlineProfile CardPM
+Quote Post

W0lfbane
RE: Load Bitmap In Form?
3 Apr, 2009 - 07:46 PM
Post #4

New D.I.C Head
*

Joined: 3 Apr, 2009
Posts: 1

QUOTE(Jonathan Malott @ 13 Oct, 2008 - 02:38 PM) *

Any idea how to make a bitmap a sprite and then make it move about the screen in even increments?

CODE
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case 38 'up arrow
        Timer1.Enabled = True
        Timer1.Interval = 5
Case 40 'down arrow
         Timer2.Enabled = True
         Timer2.Interval = 5
Case 39 'right arrow
        Timer3.Enabled = True
        Timer3.Interval = 5
                
Case 37 'left arrow
        Timer4.Enabled = True
        Timer4.Interval = 5
     End Select
End Sub

Private Sub Form_KeyUp(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case 38 'up arrow
        Timer1.Enabled = False
Case 40 'down arrow
        Timer2.Enabled = False
Case 39 'right arrow
        Timer3.Enabled = False
Case 37 'left arrow
        Timer4.Enabled = False
End Select
End Sub


Private Sub Timer1_Timer()
    Image2.Top = Image2.Top - 20
End Sub

Private Sub Timer2_Timer()
    Image2.Top = Image2.Top + 20
End Sub

Private Sub Timer3_Timer()
    Image2.Left = Image2.Left + 15
End Sub

Private Sub Timer4_Timer()
    Image2.Left = Image2.Left - 20
End Sub





Pretty much i used the cases for the arrow keys in key-down and key-up events and set them to start an alarm with a 5 tick interval on key-down. I made the up/down alarm events 20y/-20y and the left/right alarm events 15x/-15x.
This gives a fairly smooth movement through the form but there is sometimes some flickering and it's more complicated if you want to change the sprites while the picture moves to give it an animated movement look (walking)
hope this helps you.

This post has been edited by W0lfbane: 3 Apr, 2009 - 07:50 PM
User is offlineProfile CardPM
+Quote Post

firebolt
RE: Load Bitmap In Form?
3 Apr, 2009 - 08:18 PM
Post #5

Newtonian Mathematician
Group Icon

Joined: 20 Feb, 2009
Posts: 4,017



Thanked: 42 times
Dream Kudos: 1625
My Contributions
@W0lfbane,
remember, we have to abide by the forum rules and if the original poster didnot provide a code, we do not give them a code but you may give advice or a lead.

This post has been edited by firebolt: 3 Apr, 2009 - 08:18 PM
User is offlineProfile CardPM
+Quote Post

Nikhil_07n
RE: Load Bitmap In Form?
4 Apr, 2009 - 07:19 AM
Post #6

Payback Time!!!
Group Icon

Joined: 9 Jan, 2009
Posts: 1,621



Thanked: 12 times
Dream Kudos: 1200
My Contributions
QUOTE(firebolt @ 4 Apr, 2009 - 08:48 AM) *

@W0lfbane,
remember, we have to abide by the forum rules and if the original poster didnot provide a code, we do not give them a code but you may give advice or a lead.


+1
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 7/4/09 03:01PM

Live VB Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month