Windows form - no cross

A

Alan T

I want to put an icon on a Windows Form top left hand corner but would like
to hide the maximize and close box on the top right hand corner.
Can I do that?
 
D

Dipankar

Hi,

You can hide the Maximize and Close buttons in Design-time using the
Properties window.

Set ControlBox and MaximizeBox properties to false.

These two properties are grouped under Window Style category.

Cheers
Dips
 
A

Alan T

I have set the ControlBox to false but the icon has also gone.
How do I make the icon appeared?
 
D

Dipankar

Hi,

It is true that making ControlBox property false, will hide the full
control box including the icon.

Now If you want that user cannot close the Form using the Close button,
then there is a workaround.

1. Do not make ControlBox property false. Let it be true.
2. In the Form's FormClosing event, write the following code:
e.Cancel = true; // cancels the Closing event.

Cheers
Dips
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top