Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding number and letters on a form like a phone.

Status
Not open for further replies.

robUK2

Programmer
Mar 10, 2008
57
TH
Hello,

VS 2008

Adding number and letters on buttons.

I have a form that looks like a phone with buttons. I am wondering how to put number and letters on the buttons.

i.e.
1 2 3
abc def ghi

Just another question. I have wired up all the buttons for one click event. And display the numbers in the text box display.

Code:
private void DialerKeyPress_Click(object sender, EventArgs e) 
        {
            this.txtDisplay.Text += ((Button)sender).Text;    
        }

How would it be possible to display something like a 'c' or 'e' etc. The user would have to click 4 times for a 'c', and twice for a 'e'.

How is this normally implemented in a normal phone application.

Many thanks for any advice,

Steve
 
if this is a web app, then js would be a better option to determine which letter to display. 3 postbacks to print a "c" is terrible.

if this is a desktop app, then your fine with button clicks.

as for the text. something like this might work
Code:
Button1.Text = "1\nabc";
//or
Button2.Text = string.Format("2{0}def", Environment.NewLine);
//or
Button3.Text = "3\r\nghi";
...

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Your buttons can have the image property set with ImageAlign top and TextAlign bottom.

The other option would be to put your labels on a custom control and then treat the custom control like a button.


As for clicking on buttons and having the text show up - that really depends on the type of "phone" you wish to create.

Most phone vendors make you click number 2 twice to get b and 3 times to get c. After a second of no input it can accept the same button again while adding a new letter. Otherwise pressing the button would keep changing the previous letter.

Does this help?

 
Create an image that looks like phone buttons, and assign it to regular Windows.Forms (or their Web equivalents) with the border turned off.

If you want keyboad handling, you'll have to do that at the form level with KeyPress.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top