2 Replies - 1595 Views - Last Post: 19 January 2008 - 03:45 PM Rate Topic: -----

#1 Dracitus  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 19-January 08

Help me in vb 2005 express edition

Post icon  Posted 19 January 2008 - 10:29 AM

He me im lost i need a object to act like a barrier but i cant seem to figure it out im useing code like this



  Dim Loc As Point
		Select Case e.KeyCode
			Case Keys.Left
				If Not picPlayer.Location.X - 5 < 0 Then
					Loc = New Point(picPlayer.Location.X - 5, picPlayer.Location.Y)
					picPlayer.Location = Loc
				End If
			Case Keys.Right
				If Not picPlayer.Location.X + 5 > Me.Width - picPlayer.Width - 5 Then
					Loc = New Point(picPlayer.Location.X + 5, picPlayer.Location.Y)
					picPlayer.Location = Loc
				End If
			Case Keys.Up
				If Not picPlayer.Location.Y - 5 < 0 Then
					Loc = New Point(picPlayer.Location.X, picPlayer.Location.Y - 5)
					picPlayer.Location = Loc
				End If
			Case Keys.Down
				If Not picPlayer.Location.Y - 5 > Me.Height - picPlayer.Height * 1.5 Then
					Loc = New Point(picPlayer.Location.X, picPlayer.Location.Y + 5)
					picPlayer.Location = Loc
				End If
		End Select 




Please help i can go to the edgeg of the form and itll stop but if i put a buton on the form i go through the button basicly i want the button to ack like a border nd when i hiit the edge of the button on all sides (i would not wnt to go through it just stop)


Plz email me at j.a.carley@hotmail.com

Is This A Good Question/Topic? 0
  • +

Replies To: Help me in vb 2005 express edition

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1639
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Help me in vb 2005 express edition

Posted 19 January 2008 - 11:09 AM

Well you need to get the bounds of the form then make sure the button don't let the button move past that point.

Also, Express Edition is VB.Net so Im moving it to the proper forum :)
Was This Post Helpful? 0
  • +
  • -

#3 Dracitus  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 19-January 08

Re: Help me in vb 2005 express edition

Posted 19 January 2008 - 03:45 PM

View PostPsychoCoder, on 19 Jan, 2008 - 11:09 AM, said:

Well you need to get the bounds of the form then make sure the button don't let the button move past that point.

Also, Express Edition is VB.Net so Im moving it to the proper forum :)




Thanks sorry
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1