Jump to content

Recommended Posts

Posted

Ive just started programming in C# .net, any help with this problem would be of great help--thanks in advance. Also any books or resources for learning this language for Smartphone would be good.

OK i have an image in a picture box and it displays on the screen fine. what i want to happen is another picure be displayed when i press the '1' or '2' key etc but the original picture be displayed after i let go of the button again.

8)

Guest ultimasnake
Posted

if you have 1 picturebox (an empty one) and 3 picture boxes containing the images... and you have an keydown void do something like this

switch(e.keycode){

case Keys.d1:

fakebox.picture = picture1.picture; (or was it .image :()

break;

cas Keys.d2 :

fakebox.picture = picture2.picture;

break;

}

and have an keyup void

fakebox.picture = picture0.picture;

so something like that should work :lol:

(remember dont copy paste this i left out the capital letters :D copy and paste wont learn you a thing)

Posted

Sorry i didnt post back--i worked out how to do it in the end :lol: cheers dor the reply tho its exactly how i did it.

a bit of a problem tho---i used Keys.Right, Keys.Left etc for the joystick movement. Keys.D0-Keys.D9 for the number pad----what is the code for the *and # keys?? :?

Cheers for the reply man i thought no one would 8)

Guest ultimasnake
Posted

try something like this

on a keypress down void do

MessageBox.Show(e.keycode.tostring());

this will display the name that you can use in c# again with Keys. :lol:

Posted

ok this is what ive got for my Keypress down bit---just shows a different image when the key is pressed---the keyup just reverses this process.

private void Form1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)

{

switch(e.KeyCode)

{

case Keys.D1: this.pictureBox15.Visible = true;

this.pictureBox2.Visible = false;

break;

case Keys.D2 : this.pictureBox16.Visible = true;

this.pictureBox3.Visible = false;

break;

etc.............

Where do i put "MessageBox.Show(e.keycode.tostring()); "

I put it inthe switch statement but it wanted a ':' somewhere??

cheers for the help its hard getting your head round this stuff

:? 8)

Guest ultimasnake
Posted

Ofcours you could have put it before the switch :lol: but i will show you something by doing this

private void Form1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)

{

switch(e.KeyCode)

{

case Keys.D1: this.pictureBox15.Visible = true;

this.pictureBox2.Visible = false;

break;

case Keys.D2 : this.pictureBox16.Visible = true;

this.pictureBox3.Visible = false;

break;

all ahter cases here

default:

MessageBox.Show(e.Keycode.tostring());

break;

}

this will show the messagebox everytime a key is pressed which is not in an Case (this ofcourse works in everyswitch)..

also like i showed you its better to have an visible picturebox which you use to display the picture and some invicible pictureboxes that contain the real images you want to display BUT ofcourse this depends on what you want to do :D

Posted

ooooo cheers man that worked a treat

for anyone reading this the keycodes for the * and # keys are F8 and F9 :lol: :D :( :( :( that just made my day :( :( :(

ooo and the green make call button is F3 and pushing the joystick in is Return

:(

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.