If it is winform, you can add an event handler for the Load event:
this.Load += new System.EventHandler(this.YourForm_Load);
... and there you can check whether it is a touch screen or not, and then arrange the positions, shapes and sizes in separate auxiliary methods for two cases.
private void YourForm_Load(object sender, System.EventArgs e) { if (IsTouchScreen) { ArrangeControlsForTouchScreen(); } else { ArrangeControlsForPlainScreen(); } }
If this is on a web page, you can do almost the same thing in the redefined Page.Load method.
source share