Jump to content


Picture box question

- - - - -

  • Please log in to reply
6 replies to this topic

#1
MECX

MECX

    Hardcore

  • Members
  • PipPipPipPipPipPip
  • 1,077 posts
  • Location:Norwich (ish)
  • Interests:Phones Woman Cars etc
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)

Lifes nothin but bitches and money
O:)  :-#  :-({|=  =D>  :D/  #-o  =p~  :-s  =;  :^o  [-X  [-o<  :-$  8-[  :-&  :cheesy:  [-(  :-k  ](*,)  :-"  :arrow:  :arrowd:  :arrowl:  :arrowu:  :D  :?:  8)  :cry:  :shock:  :evil:  :exclaim:  :frown:  :idea:  :lol:  :x  :mrgreen:  :|  :??:  :P  :oops:  :roll:  :(  :)  :o  :twisted:  ;)

#2
ultimasnake

ultimasnake

    Addict

  • Members
  • PipPipPipPipPip
  • 758 posts
  • Location:Amsterdam Holland
  • Interests:Programming<br />Gaming<br />Woman :P
  • Devices:Imate JAM/Orange E200
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)

Current Project :
Smart commander
Great new application to control your pc

Smart Browser the (first) PIE alternative
Click here for the official website

Try some other great free software like :
Gaydar
Homers Bar Quotes
Erotic dice

and soon more at ultimasoftware

#3
MECX

MECX

    Hardcore

  • Members
  • PipPipPipPipPipPip
  • 1,077 posts
  • Location:Norwich (ish)
  • Interests:Phones Woman Cars etc
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)

Lifes nothin but bitches and money
O:)  :-#  :-({|=  =D>  :D/  #-o  =p~  :-s  =;  :^o  [-X  [-o<  :-$  8-[  :-&  :cheesy:  [-(  :-k  ](*,)  :-"  :arrow:  :arrowd:  :arrowl:  :arrowu:  :D  :?:  8)  :cry:  :shock:  :evil:  :exclaim:  :frown:  :idea:  :lol:  :x  :mrgreen:  :|  :??:  :P  :oops:  :roll:  :(  :)  :o  :twisted:  ;)

#4
ultimasnake

ultimasnake

    Addict

  • Members
  • PipPipPipPipPip
  • 758 posts
  • Location:Amsterdam Holland
  • Interests:Programming<br />Gaming<br />Woman :P
  • Devices:Imate JAM/Orange E200
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:

Current Project :
Smart commander
Great new application to control your pc

Smart Browser the (first) PIE alternative
Click here for the official website

Try some other great free software like :
Gaydar
Homers Bar Quotes
Erotic dice

and soon more at ultimasoftware

#5
MECX

MECX

    Hardcore

  • Members
  • PipPipPipPipPipPip
  • 1,077 posts
  • Location:Norwich (ish)
  • Interests:Phones Woman Cars etc
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)

Lifes nothin but bitches and money
O:)  :-#  :-({|=  =D>  :D/  #-o  =p~  :-s  =;  :^o  [-X  [-o<  :-$  8-[  :-&  :cheesy:  [-(  :-k  ](*,)  :-"  :arrow:  :arrowd:  :arrowl:  :arrowu:  :D  :?:  8)  :cry:  :shock:  :evil:  :exclaim:  :frown:  :idea:  :lol:  :x  :mrgreen:  :|  :??:  :P  :oops:  :roll:  :(  :)  :o  :twisted:  ;)

#6
ultimasnake

ultimasnake

    Addict

  • Members
  • PipPipPipPipPip
  • 758 posts
  • Location:Amsterdam Holland
  • Interests:Programming<br />Gaming<br />Woman :P
  • Devices:Imate JAM/Orange E200
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

Current Project :
Smart commander
Great new application to control your pc

Smart Browser the (first) PIE alternative
Click here for the official website

Try some other great free software like :
Gaydar
Homers Bar Quotes
Erotic dice

and soon more at ultimasoftware

#7
MECX

MECX

    Hardcore

  • Members
  • PipPipPipPipPipPip
  • 1,077 posts
  • Location:Norwich (ish)
  • Interests:Phones Woman Cars etc
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

:(

Lifes nothin but bitches and money
O:)  :-#  :-({|=  =D>  :D/  #-o  =p~  :-s  =;  :^o  [-X  [-o<  :-$  8-[  :-&  :cheesy:  [-(  :-k  ](*,)  :-"  :arrow:  :arrowd:  :arrowl:  :arrowu:  :D  :?:  8)  :cry:  :shock:  :evil:  :exclaim:  :frown:  :idea:  :lol:  :x  :mrgreen:  :|  :??:  :P  :oops:  :roll:  :(  :)  :o  :twisted:  ;)




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users