MessageBox and soft ButtonClick

Show me an example of how I can programmatically raise an event in UI controls, for example ButtonClick for a MessageBox

You can look at CarWashExample, file paymentwindow.cs

I don’t have a touchscreen. There are only physical buttons. How to emulate a click on the touchscreen and get a modal result from messagebox?

I think you need to customize the UI messagebox.

Windows wasn’t designed with microcontrollers in mind. If you want to play in the Win32 space, there are ways to emulate mouse clicks using interop calls (e.g. .net - How do you simulate Mouse Click in C#? - Stack Overflow)

Otherwise, it’s really not that hard to create your own messagebox style UI using a headerless or frameless Win Form and some events / delegates to ‘listen’ for your button presses instead. This is the approach I took on one of my projects - rolled my own WPF Messagebox so that I could use custom backgrounds, formattable text and change elements on the fly.

Thanks. Can I see how you implemented Messagebox?

I think this can help, look at button input.

(User Interface)