A very common question when you start to work with forms and the .Net Compact Framework is how to replace the 'x' button on the title bar with an 'ok' button. By default, a new form is created showing an 'x' button, which is a minimize box on the title bar:
In runtime, it behaves as a minimize button, when the user press this button the form is minimized. Sometimes we prefer to replace this button with an 'ok' button, as in a dialog. This is very easy. Just open the form on design mode and change the MinimizeBox property to false:
Now we have a new 'ok' button which will close the form in runtime setting the form DialogResult property to DialogResult.OK
If you want to hide both buttons, you can set the ControlBox property of the form to false.
Now the form doesn't have any buttons on the title bar.
Indeed, all these from properties can be changed programmatically from your code. It's really easy! Isn't it?
No comments:
Post a Comment