If you can’t edit Style using BitmapStyleDesigner
, there is a way (Technical arrangement) to make.
You should add a TPanel
with Height
of +/- 32 (at your discretion) with Align = alTop
.
In this Panel you will add the buttons you want (I recommend Tspeedbutton) with Align = alRight
, putting the buttons always arranged on the right if hide any or resize the window they will automatically align, similar to the original.
Now define the BordeStyle
of the Form as bsNone
.
To close the button use the Close
For the Minimize Button use the Application.Minimize
For the Restore/Minimize:
if (Nome_Form.WindowState = wsMaximized) then
begin
Nome_Form.WindowState := wsNormal;
{altere a imagem do botão aqui para a que desejar}
end
else
begin
Nome_Form.WindowState := wsMaximized;
{altere a imagem do botão aqui para a que desejar}
end;
Now just add the additional buttons you want,
Laborious, but if it is the last option you will notice that the result is TOP.
Edit 01: Moving the Form:
In the Onmousedown Panel Event (which is now your Title bar):
begin
if (Button = mbLeft) then
begin
ReleaseCapture;
Perform(WM_SYSCOMMAND,$F012,0);
end;
Edit 02: Resizing the Form:
Declare in the Private: procedure WMNCHitTest(var Msg: TWMNCHitTest); message WM_NCHITTEST;
procedure Nome_Form.WMNCHitTest(var Msg: TWMNCHitTest);
var
ScreenPt: TPoint;
begin
//inherited;
ScreenPt := ScreenToClient(Point(Msg.Xpos, Msg.Ypos));
if (ScreenPt.x < 5) then
Msg.Result := HTLEFT
// top side
else if (ScreenPt.y < 5) then
Msg.Result := HTTOP
// right side
else if (ScreenPt.x >= Width - 5) then
Msg.Result := HTRIGHT
// bottom side
else if (ScreenPt.y >= Height - 5) then
Msg.Result := HTBOTTOM
// top left corner
else if (ScreenPt.x < 5) and (ScreenPt.y < 5) then
Msg.Result := HTTOPLEFT
// bottom left corner
else if (ScreenPt.x < 5) and (ScreenPt.y >= Height - 5) then
Msg.Result := HTBOTTOMLEFT
// top right corner
else if (ScreenPt.x >= Width - 5) and (ScreenPt.y < 5) then
Msg.Result := HTTOPRIGHT
// bottom right corner
else if (ScreenPt.x >= Width - 5) and (ScreenPt.y >= Height - 5) then
Msg.Result := HTBOTTOMRIGHT
end;
Note: The Statement of the procedure that resizes should be like this, different from the body of the procedure, works as if sending a SendMessage
to the Api windows!
That way until the Mouse Cursor will change shape when approaching the form border!
Edit 03: Container New
Now as the Form has no edge, we need to create a new Container for the components that need to be aligned using for example alClient, alLeft etc...
In the OnResize
of Form:
Panel_Principal.Left := 5;
Panel_Principal.Top := 5; {observar o outro panel que é a barra de Título}
Panel_Principal.Width := Nome_Form.Width - 10;
Panel_Principal.Height := Nome_Form.Height - 10;
This way the Main Panel_and the Form will create the border effect.
Important: In order not to have all this trouble in all the Foms, you must use this as a Model and the others to use as Inheritance. However, for each new form on OnResize
you should re-program the same OnResize
.
Search for skins in Delphi :)
– karanalpe
Your button is a Tbitbtn ? If it is just put the image in the property
Glyph
.– Victor Tadashi
the buttons in question are those of the form
– Tmc
I’m not sure if it’s introduced in Delphi 2010, but in XE you can customize a style, including the buttons form, see: http://community.embarcadero.com/blogs/entry/customizing-and-creating-vcl-styles-671
– stderr
Aa, I understand your question. This @stderr example works. I’ve already had to do this once.
– Victor Tadashi
@stderr This configuration type is not available for Delphi 2010, any suggestions more?
– Tmc
@Karanpereira what you mean by this can be more explicit?
– Tmc
takes a look at your Delphi installation folder, inside the bin folder, must have an executable called Bitmapstyledesigner.exe
– Victor Tadashi
@Victorzanella knows where I can find this designide230.bpl file, when I run Bitmapstyledesigner.exe he says he has that missing file
– Tmc
Weird, bpls 23 are from Delphi 10 Seattle. And you said you have the 2010 version installed.
– Victor Tadashi
already had the two versions on the pc may have been that that screwed the . exe I’ll see if arrange to run it
– Tmc
Please do not vandalize your posts. It is inappropriate because it means that future readers will not get help from the answers.
– DJMcMayhem