views:

303

answers:

3

How do I create a second form with a close button,but without an icon.

+3  A: 

Set the form's BorderStyle to bsDialog.

Stijn Sanders
The border then is too small.
John
You could also remove biMinimize and biMaximize from BorderIcons
Stijn Sanders
A: 

I am afraid you cannot do it in other way, than experimenting with BorderStyle property, since this is done by VCL internally.

smok1
+2  A: 

Set form's BorderStyle to bsDialog and use this code on form create,

SetWindowLong(Handle,gwl_style,GetWindowLong(handle,gwl_style) or WS_THICKFRAME);
ClientHeight := Height;
Refresh;

I think it's an ugly hack but you may find it ok.

Nick D
I will accept it,because it's a great alternative,but the close button is not looking the same as if the window's borderstly was bsSizeable.I'm skinning my form,that's the problem.But thanks!
John