The buttons automatically assign an event to the OnClick event handler and should, by default make the form minimize, maximize and close. So you cannot override the OnClick event handler. If you want to override the default behavior you need to hide the buttons, and replace them with your own buttons.