-
Notifications
You must be signed in to change notification settings - Fork 114
VclStylesNC
Rodrigo Ruz edited this page May 14, 2017
·
7 revisions
The Vcl.Styles.NC unit allows add controls in the Non Client Area of the forms through the TNCControls component, you can try a sample application here.
The next code shows how add a button to the title bar of the form.
procedure TForm1.FormCreate(Sender: TObject);
begin
NCControls := TNCControls.Create(Self);
//Set the image list
NCControls.Images := ImageList1;
//Add a NC Button
NCControls.Controls.AddEx<TNCButton>;
//Set the style of the button
NCControls[0].GetAs<TNCButton>.Style := nsSplitButton;
//Set the style of the image
NCControls[0].GetAs<TNCButton>.ImageStyle := isGrayHot;
NCControls[0].GetAs<TNCButton>.ImageIndex := 3;
//Set the bounds
NCControls[0].BoundsRect := Rect(30,5,100,25);
NCControls[0].Caption := 'Menu';
//Assign the menu and events.
NCControls[0].GetAs<TNCButton>.DropDownMenu:= PopupMenu1;
NCControls[0].GetAs<TNCButton>.OnClick := ButtonNCClick;
end;