0
votes

I removed caption bar of my window so now it only has a border around it. I don't want to set BorderStyle to bsNone but I want to remove border. How can I do it?

let me explain more. I want to make sth like Photoshop GUI. If I set border style to bsNone, I'll lose lots of features on win7. I tried to use GraphicControls instead of Form Caption bar to move the window (by handling WMNCHitTest message). It works but double click doesn't maximize and restore the window when border style is bsNone but everything works well when it is bsResizable. I want to set BorderStyle to bsResizable but I want to remove the border like when it is bsNone

3
Any particular reason why you want to do this? It's generally best not to fight the operating system on user interface matters, both for your own sanity and for the users' ability to concentrate. It's distracting if they're faced with nonstandard UI elements.Mason Wheeler
It is not clear what result you wish to achieve. The Windows aero border cannot be made 1 px thin, because, well, it is not a single-colour border. Do you just want a 1px single-colour border around your form? Then set BorderStyle to bsNone and position four TShape controls at alTop, alRight, alBottom, and alLeft.Andreas Rejbrand
Mason got a very good point, don't screw with the interface too much, after all the whole point of a software is to be functional, not having weird and non-standard interface, let windows deal with the interface...user497849
let me explain more. this is my fault i didn't mention what i'm actually going to do. I want to make sth like Photoshop GUI. If I set border style to bsNone, I'll lose lots of features on win7. I tried to use GraphicControls instead of Form Caption bar to move the window (by handling WMNCHitTest message). It works but double click doesn't maximize and restore the window when border style is bsNone but everything works well when it is bsResizable. I want to set BorderStyle to bsResizable but I want to remove the border like when it is bsNoneJavid
@Javid - You might have some partial success with WM_NCCALCSIZE, you can inflate the client area there. But I guess the top part would pose some problems (border above caption). Then, probably you'd have to paint the borders yourself by handling WM_NCPAINT (there won't be any 3D look f.i. with a 1px border). It would mean then, painting also the caption, buttons etc.. Much work I guess.. :)Sertac Akyuz

3 Answers

2
votes

You can set the form's border to bsNone and then add a panel to the form. Set the panel's align property to alClient and adjust its border however you like. You have control over the inner and outer bevels and their widths to a 1 pixel granularity. Since Panel1 is a container, it should be easy to just drag everything onto it as though it were the form itself. In the designer, it would be nearly invisible.

If you are not familiar with it, you can drag all the controls from one container to another using the structure view (it's called the object treeview in older versions). This makes it so you don't have to redesign your form to do this. If the panel itself is a problem, you can always just send it to the back and leave all the other controls on the form. It will look exactly the same, but then the controls maintain a TForm parent instead of a TPanel parent. It's just a little extra thing to maintain in the designer.

Having said that, I also recommend considering Mason's comment about nonstandard UIs.

1
votes

Setting the borderstyle to "bsSizeToolWin" isn't an option? It would be a thinner border, but it would be resizeable and it's still conform the Windows standard...

0
votes

I haven't seen latest Photoshop, but I guess you need something like that: http://delphihaven.wordpress.com/2010/04/22/setting-up-a-custom-title-bar-reprise/