📄 flag.pas
字号:
unit Flag;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TFlagForm = class(TForm)
Label1: TLabel;
Label2: TLabel;
chkURGMask: TCheckBox;
chkACKMask: TCheckBox;
chkPSHMask: TCheckBox;
chkRSTMask: TCheckBox;
chkSYNMask: TCheckBox;
chkFINMask: TCheckBox;
chkURGValue: TCheckBox;
chkACKValue: TCheckBox;
chkPSHValue: TCheckBox;
chkRSTValue: TCheckBox;
chkSYNValue: TCheckBox;
chkFINValue: TCheckBox;
btnOK: TButton;
btnCancel: TButton;
procedure chkMaskClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
function GetMask: Byte;
function GetValue: Byte;
end;
var
FlagForm: TFlagForm;
implementation
{$R *.DFM}
function TFlagForm.GetMask: Byte;
begin
Result := 0;
if chkURGMask.Checked then Result := Result or $20;
if chkACKMask.Checked then Result := Result or $10;
if chkPSHMask.Checked then Result := Result or $08;
if chkRSTMask.Checked then Result := Result or $04;
if chkSYNMask.Checked then Result := Result or $02;
if chkFINMask.Checked then Result := Result or $01;
end;
function TFlagForm.GetValue: Byte;
begin
Result := 0;
if chkURGValue.Enabled and chkURGValue.Checked then Result := result or $20;
if chkACKValue.Enabled and chkACKValue.Checked then Result := result or $10;
if chkPSHValue.Enabled and chkPSHValue.Checked then Result := result or $08;
if chkRSTValue.Enabled and chkRSTValue.Checked then Result := result or $04;
if chkSYNValue.Enabled and chkSYNValue.Checked then Result := result or $02;
if chkFINValue.Enabled and chkFINValue.Checked then Result := result or $01;
end;
procedure TFlagForm.chkMaskClick(Sender: TObject);
begin
chkURGValue.Enabled := chkURGMask.Checked;
chkACKValue.Enabled := chkACKMask.Checked;
chkPSHValue.Enabled := chkPSHMask.Checked;
chkRSTValue.Enabled := chkRSTMask.Checked;
chkSYNValue.Enabled := chkSYNMask.Checked;
chkFINValue.Enabled := chkFINMask.Checked;
if not chkURGMask.Checked then chkURGValue.Checked := false;
if not chkACKMask.Checked then chkACKValue.Checked := false;
if not chkPSHMask.Checked then chkPSHValue.Checked := false;
if not chkRSTMask.Checked then chkRSTValue.Checked := false;
if not chkSYNMask.Checked then chkSYNValue.Checked := false;
if not chkFINMask.Checked then chkFINValue.Checked := false;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -