Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

2 VB.Net Code Questions | Need help with codding

1)
I have 9 PictureBoxes sorted like fields in tic-tac-toe...like this:

☐ ☐ ☐
☐ ☐ ☐
☐ ☐ ☐

and now when someone clicks one of these I want to change collor of the one below it..how can I know witch one's bellow? (I know I can just look but would took forever to write xD) I could get coordinates of it but I don't know what to do next...



2)
I'm making simple 2D game where you can run and jump XD Like this: http://www.siguientefase.com/wp-content/...rmario.jpg

How can I make gravity? XD
If there is just 9 pictureboxes, its substantial amount of work, lol.
Either name your boxes appropriately (i.e. pic01, pic02, etc) or, since you should know the size of each box and the space between them, add those to the click location and use ControlFromPoint to get the box below.
[Image: Xtddh8V.png]
@Fake thank's I'll try it
@Coleak This is just example....there's actually more than 9 ;D
Quote:and now when someone clicks one of these I want to change collor of the one below it..how can I know witch one's bellow? (I know I can just look but would took forever to write xD) I could get coordinates of it but I don't know what to do next...


And now what if you click the bottom picturebox in a column? What is supposed to happen nothing? Otherwise this is pretty easy.
Getting Started: C/C++
[C/C++/.NET/x86 ASM - Automation Programmer]
(May 5, 2012 04:22 PM)0xDEAD10CC Wrote:  And now what if you click the bottom picturebox in a column? What is supposed to happen nothing? Otherwise this is pretty easy.

Nothing....if there isn't box below it shouldn't do anything..
Code
Private Sub PictureBox_Click(sender As System.Object, e As System.EventArgs) Handles PictureBox8.Click, PictureBox7.Click, PictureBox5.Click, PictureBox4.Click, PictureBox2.Click, PictureBox1.Click
  Dim picbox_arr As PictureBox() = {PictureBox1, PictureBox2, PictureBox3, PictureBox4, PictureBox5, PictureBox6, PictureBox7, PictureBox8, PictureBox9}
  picbox_arr(Array.IndexOf(picbox_arr, DirectCast(sender, PictureBox)) + 1).BackColor = Color.Black
    End Sub

You're not doing anything with picturebox3, 6, and 9 so I don't have handlers for them in this example.

My arrangement: "PictureBox{#}"
Code
147
258
369
Getting Started: C/C++
[C/C++/.NET/x86 ASM - Automation Programmer]


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by stickler39modzMar 21, 2017 07:14 AM 14 522 Mar 21, 2017 07:14 AM
Last Post: DarkCart
[C#] by newmechaMay 28, 2016 05:52 AM 4 211 May 28, 2016 05:52 AM
Last Post: He B TeMy
[C] by GhostClient WantedApr 22, 2015 07:02 AM 2 108 Apr 22, 2015 07:02 AM
Last Post: Mouse❤️