⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 btngroupsform.pas

📁 source code for Marco Cantu s book Delphi 2007 Handbook
💻 PAS
字号:
unit BtnGroupsForm;

interface

{$WARN UNIT_PLATFORM OFF}

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ButtonGroup, ImgList, CategoryButtons;

type
  TFormBtnGroups = class(TForm)
    ButtonGroup1: TButtonGroup;
    ImageList1: TImageList;
    CategoryButtons1: TCategoryButtons;
    procedure ButtonGroup1ButtonClicked(Sender: TObject; Index: Integer);
    procedure CategoryButtons1ButtonClicked(Sender: TObject;
      const Button: TButtonItem);
    procedure ButtonGroup1Items3Click(Sender: TObject);
    procedure ButtonGroup1Items2Click(Sender: TObject);
    procedure ButtonGroup1Items1Click(Sender: TObject);
    procedure ButtonGroup1Items0Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FormBtnGroups: TFormBtnGroups;

implementation

{$R *.dfm}

procedure TFormBtnGroups.ButtonGroup1Items0Click(Sender: TObject);
begin
  with ButtonGroup1.Items.Add do
    Caption := 'btn' + IntToStr (ButtonGroup1.Items.Count);
end;

procedure TFormBtnGroups.ButtonGroup1Items1Click(Sender: TObject);
begin
  ButtonGroup1.ButtonWidth := ButtonGroup1.ButtonWidth * 2;
end;

procedure TFormBtnGroups.ButtonGroup1Items2Click(Sender: TObject);
begin
  ButtonGroup1.ButtonWidth := ButtonGroup1.ButtonWidth div 2;
end;

procedure TFormBtnGroups.ButtonGroup1Items3Click(Sender: TObject);
begin
  if gboShowCaptions in ButtonGroup1.ButtonOptions then
    ButtonGroup1.ButtonOptions := ButtonGroup1.ButtonOptions - [gboShowCaptions]
  else
    ButtonGroup1.ButtonOptions := ButtonGroup1.ButtonOptions + [gboShowCaptions];
end;

procedure TFormBtnGroups.CategoryButtons1ButtonClicked(Sender: TObject;
  const Button: TButtonItem);
begin
  ShowMessage ('Pressed ' + Button.Caption + ' of ' + Button.Category.Caption);
end;

procedure TFormBtnGroups.ButtonGroup1ButtonClicked(Sender: TObject;
  Index: Integer);
begin
  ShowMessage (ButtonGroup1.Items[Index].Caption);
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -