![]() |
|
[.NET] 2 VB.Net Code Questions | Need help with codding - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [.NET] 2 VB.Net Code Questions | Need help with codding (/showthread.php?tid=2467343) |
2 VB.Net Code Questions | Need help with codding - MegaMember - May 5, 2012 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/uploads/2007/10/superpapermario.jpg How can I make gravity? XD * - Coleak - May 5, 2012 If there is just 9 pictureboxes, its substantial amount of work, lol. * - Fake. - May 5, 2012 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. * - MegaMember - May 5, 2012 @Fake thank's I'll try it @Coleak This is just example....there's actually more than 9 ;D * - 0xDEAD10CC - May 5, 2012 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. * - MegaMember - May 5, 2012 (May 5, 2012 04:22 PM)PhazeShift 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.. * - 0xDEAD10CC - May 5, 2012 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.ClickYou'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 |