| |

VerySource

 Forgot password?
 Register
Search
View: 707|Reply: 2

Encountered two problems can not be solved while doing software, ask! (Shortcuts and text selection issues for controls)

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-2-12 10:30:01
| Show all posts |Read mode
Hello everyone! I made a small software for timing reminders, and most of them are currently completed. However, there are two problems that have not been solved when optimizing the function. Please help me, thank you!

1. There are four radio buttons in the software interface. My current thought is that I want to use the keyboard to control the selection of radio buttons, such as pressing Ctrl + F1 to automatically select the first button, Ctrl + F2 to select the second, and so on. The bottleneck now is that I ca n’t write keyboard events, because the focus is set on the first button as soon as my program starts, so I did n’t add keyboard events to the form code (I did an experiment, only when there was no Use this method within the control's form so that the program can respond to keyboard events). My intention is that no matter where the current focus is, as long as you press Ctrl + f1, you will respond. How do I compile the code! I really can't figure it out! Don't add all the controls to a keyboard event!

2. When a radio button is selected, my program is set to receive the focus in the number box (NumbericUpDown) corresponding to the selected radio button. Now I also want a function that is not only to receive the focus, but also to automatically select the numbers inside and make them blue so that the user can directly enter the numbers, but I looked at them as if the The function is only available when the object is a text character, but the object in the value box is a number. What should I do?
Reply

Use magic Report

0

Threads

13

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2020-4-8 22:15:01
| Show all posts
Question 1: Set the KeyPreview of Form to true
Reply

Use magic Report

0

Threads

13

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2020-4-9 08:45:01
| Show all posts
Question 2:
numericUpDown1.Focus ();
numericUpDown1.Select (stratIndex, len);
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list