Mega Code Archive

 
Categories / Delphi / VCL
 

Disabling system menu in code

Question: How can I disable the forms system menu and the Minimize, Maximize, and Close Buttons in code at Runtime? Answer: The following demonstrates disabling the buttons and system menu on the form's caption bar. Example: procedure TForm1.Button1Click(Sender: TObject); begin {Disable} Form1.BorderIcons := Form1.BorderIcons - [biSystemMenu, biMinimize, biMaximize]; end; procedure TForm1.Button2Click(Sender: TObject); begin {Enable} Form1.BorderIcons := Form1.BorderIcons + [biSystemMenu, biMinimize, biMaximize]; end;