How can I change window border size? - delphi

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

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.

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...

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/

Related

Delphi Project with custom Style

I want to create a Delphi project with a custom Style, like the below image.
As you can see, the MainForm is transparent, and there are some components inside of it.
How can I create this transparent MainForm?
P.S:I want to create VCL project and i drawn this image by Photoshop.
Assuming you're using Firemonkey since you dont specify VCL or FMX.
You don't really need to create a style for this. Rather a simpler way would be to:
Set the form transparent property to True
Place a TRectangle on the form and make it align to Most left and adjust the color etc to your liking.
Place another TRectangle on your form and set the alignment to Client. You can then adjust the Opacity property for transparency, the fill property for color and then the stroke for the border.
I see a small space between the left and right in the photo. This can be done by setting a margin left value on the second TRectangle you placed.
Now this should look like you what want it to be provided you disabled the border of the form. There is 1 more thing we need to do to avoid having the controls show as transparent. We need to place a layout on the form. Not the rectangle. If you place the controls on the rectangle with opacity the controls will also be transparent. If you want the controls to have the same transparency value place it on the rectangle. Otherwise do the following:
Place a TLayout on the form. Not the rectangle.
Set the align property to Contents. This will make it overlap everything.
Set the margin left property of the layout to the width of the left rectangle you placed + the margin value of the client rectangle you placed to compensate for the little space.
Place your controls on the layout and they should show with default opacity.
One last thing to do is implement window drag. Assuming you disabled the border, your users will not be able to move the window at all since there is no border to drag. On the MouseDown event of the component you want the drag to start add the following code:
procedure TForm1.rctngl1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Single);
begin
StartWindowDrag;
end;
You should be all done now.
EDIT: I made an example after posting this answer: FMX Semi Transparent Form

docking a panel in a frame using delphi

I have an application made with frames.
I have a panel on the frame that I need to work out how to float and dock.
I'm not sure how to accomplish this.
I looked at devexpress docking controls, but they only work with forms.
So I think I need to work out 2 issues.
how to make the panel movable and resizable.
how to add docking logic to a frame?
any help will be appreciated.
1) TPanel movable and resizable
A Panel is always movable inside its container (Form, frame, another panel, scrollbox,...) and resizable. You just have to change its Top, Left, width and height properties. To make it dragable, you need to use MouseDown, MouseMove, MouseUp event, detect and handle the required mouse use to drag.
You can even move the TPanel from its container to another container by changing its Parent property. For example, you can move a panel from a TForm to another TForm. That's what you'll use for making your panel floating.
2) Floating TFrame
You cannot use a TFrame as a floating form. You need a TForm for that.
Note that you can use a TForm much like a TFrame. Use CreateParented to create the form and attach it to a container like a TFrame.

Autosize Form with Memo in Delphi 10.1

I have a problem with a TForm who contain a TMemo. If Autosize is set to True on the TForm, my TForm is halved and then I can size it ...
That's exactly this problem : https://www.youtube.com/watch?v=3eG3kwRgPTo
I'm with Delphi 10.1 Berlin, all is ok with my Delphi XE6.
Did you know how I can fix it ?
Thanks
You have a kind of circular reference in that the child windows are resizing themselves to the parent and the parent resizing itself to the children, and none of them specifying a width. I agree it is odd that adding a TMemo seems to screw things up but like any circular reference it needs to be broken, so either you need to resize the screen programmatically or, as would probably be better in your case, simply size the panels and don't use the align properties of those. I have tried that approach and it works.
Of course this only allows the top or bottom panel to be made invisible - not those in the middle.

Remove Indentation on TreeViewItems in Firemonkey XE5

I'm trying to remove all indentations on a TreeView in Firemonkey so that a TreeView will display as a flat list regardless of the parent child relationships within the treeview.
I've had a look at the stylebook and there's nothing there that looks like it sets the indentation depth.
Is there an easy way to do this?
There is a way to do this in XE6 (I haven't tested this in XE5 but I assume it's the same). Set up a custom style for your items in your stylebook (or use treeviewitemstyle if you want this to apply to all treeviews), add a TLayout (or any control) as a child of the style, give it a StyleName of "expander", set the Visible property to False and make the width of 0. Apply and close the style designer, then set the StyleLookup of all your TreeViewItems to your custom style and the indent will disappear.

How to make TLayout invisible in design time in delphi firemonkey?

I am building a simple application which consists of many TLayouts components. I have to make one of the TLayouts invisible so that I can work on other TLayout.
Please help me in this problem
I have to make one of the TLayouts invisible so that I can work on
other TLayout.
To hide a TLayout at Runtime, simply set its Visible property to False.
To make it Visible again, set the same property to True.
To hide a TLayout at DesignTime, simply set its DesignVisible property to False.

Resources