sradiobutton.pas
来自「AlphaControls是一个Delphi标准控件的集合」· PAS 代码 · 共 52 行
PAS
52 行
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 + =
减小字号Ctrl + -
显示快捷键?