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

📄 sradiobutton.pas

📁 AlphaControls是一个Delphi标准控件的集合
💻 PAS
字号:
unit sRadioButton;
{$I sDefs.inc}

interface

uses
  Windows, Messages, Classes, Graphics, Controls, SysUtils, Forms, ExtCtrls, Dialogs,
    sStyleUtil, sCheckedControl, sConst, sGraphUtils, sUtils;

type
  TsRadioButton = class(TsCheckedControl)
  private
  protected
    function BeforeCheck(Value : boolean): boolean; override;
  public
    constructor Create(AOwner : TComponent); override;
  published
  end;

implementation

uses sPanel, sVclUtils;

function TsRadioButton.BeforeCheck(Value : boolean) : boolean;
var
  i : integer;
begin
  Result := False;
  if Value then begin
    if not Checked then begin
      for i := 0 to Parent.ControlCount - 1 do begin
        if (Parent.Controls[i] is TsRadioButton) and (Parent.Controls[i] <> Self)then begin
          TsCheckedControl(Parent.Controls[i]).FChecked := False;
          SetControlChanged(Parent.Controls[i], True);
          TsCheckedControl(Parent.Controls[i]).Repaint;
        end;
      end;
      Result := True;
    end;
  end
  else Result := Checked;
end;

constructor TsRadioButton.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  sStyle.COC := COC_TsRadioButton;
end;

end.

⌨️ 快捷键说明

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