How to make this in C# [modified]
-
Hi there I think everybody know about OnScreen Keyboard[^] from MS Windows(type osk in run). I wish to make that kind of application using C# but i have the following questions: 1) Those buttons are customs controls? 2) How to have just one function which triggers the pressed keys?
modified on Thursday, October 30, 2008 5:50 AM
-
Hi there I think everybody know about OnScreen Keyboard[^] from MS Windows(type osk in run). I wish to make that kind of application using C# but i have the following questions: 1) Those buttons are customs controls? 2) How to have just one function which triggers the pressed keys?
modified on Thursday, October 30, 2008 5:50 AM
Someone who is actually researching! That deserves some help :)
duta wrote:
- Those buttons are customs controls?
Those buttons won't be custom controls in the original program. However, Custom Controls would be an idea if you want to build something like that yourself. You could also use a "real" button, but those aren't flat.
duta wrote:
- How to have just one function which triggers the pressed keys?
Drag two buttons on the screen, and double-click on the OnClick handler of button1. This will create an event-handler for button1. Next, click once on the OnClick-handler of button2, and you'll get a list of events that have been built. Choose the event of button1. Both now point to the same event. You can also do this in code. First, create a general event-handler for the buttons;
void button1\_Click(object sender, EventArgs e) { // Sender tells you what button has been pressed }
In the load-event of your form, add some code to wire-up the events;
this.button1.Click += new EventHandler(button1_Click);
You can wire the second button to the same handler;
this.button2.Click += new EventHandler(button1_Click);
This way the Click-event of button2 will point to the eventhandler as declared for button1. Hope this helps :)