Show/Hide header/footer of an application in code

Is it possible to show/hide the header/footer of an application from code? i.e. in one of the “Events” during runtine.