Skip to content
The Road to Delphi — Delphi, VCL, VCL Styles, UxTheme and WinAPI

VCL Styles Utils – New Feature : Non Client Area Controls

,

I’m very pleased to introduce a very cool new feature to the VCL Styles Utils project. This is the support for controls in the Non Client Area of the forms through the TNCControls component.

Check the next form with the Auric Vcl Style applied.

1

Now the same form but with a set of NC Buttons in the title bar.

2

To use in your forms you only need to add the Vcl.Styles.NC and Vcl.Styles.FormStyleHooks units to your project and create a TNCControls component in each form where do you want use the NC Controls.

Check the next sample code

[sourcecode language=”delphi”]
procedure TForm1.FormCreate(Sender: TObject);
begin
NCControls:=TNCControls.Create(Self);
//Add a NC Button
NCControls.List.Add(TNCButton.Create(NCControls));
//Set the style of the button
NCControls.List[0].Style := nsSplitButton;
//Set the style of the image
NCControls.List[0].ImageStyle := isGrayHot;
//Set the image list
NCControls.List[0].Images := ImageList1;
NCControls.List[0].ImageIndex := 3;
//Set the bounds
NCControls.List[0].BoundsRect := Rect(30,5,100,25);
NCControls.List[0].Caption := ‘Menu’;
//Assign the menu and events.
NCControls.List[0].DropDownMenu:= PopupMenu1;
NCControls.List[0].OnClick := ButtonNCClick;
end;
[/sourcecode]

And this is the result

4

Screenshots

3

Exist 4 kind of buttons which you can choose.
5

Also you can use a custom Vcl Style to draw the controls.
6

Try the sample application from the project repository.
Also you can download a compiled demo from here.

Remember report any bug o made your suggestions via the issue page of the project.

4 responses

  1. briantokyo Avatar
    briantokyo

    That’s really awesome! I had been looking into properly adding buttons etc to the titlebar for ages but all attempts were a messy outcome, this is great!

  2. whow, really nice stuff

  3. briantokyo Avatar
    briantokyo

    Can you make it work with the default Windows style?

    1. This component is specific for the VCL Styles. For the Windows native look and feel is necessary write a new component, maybe I will do that in the future ;)

Leave a Reply