📄 telock.pas
字号:
unit TELock;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons, inifiles, ExtCtrls, Mask, XPMenu, TFlatPanelUnit,
TFlatSpeedButtonUnit, XP_Button;
type
TLockf = class(TForm)
FlatPanel1: TFlatPanel;
FlatPanel2: TFlatPanel;
Memo1: TMemo;
Bevel1: TBevel;
ComboBox1: TComboBox;
Label1: TLabel;
CheckBox1: TCheckBox;
Edit1: TMaskEdit;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
XPMenu1: TXPMenu;
FlatSpeedButton1: TFlatSpeedButton;
XP_Button1: TXP_Button;
XP_Button2: TXP_Button;
XP_Button3: TXP_Button;
procedure BitBtn1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
procedure CheckBox1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Lockf: TLockf;
implementation
uses main;
{$R *.DFM}
procedure TLockf.BitBtn1Click(Sender: TObject);
var
i: smallint;
begin
for i := 0 to student_count - 1 do
begin
//s_index := s_student[i];
if (form1.ListView1.Items[i].imageindex <> 0) and (form1.listView1.Items[i].Selected = true) then
begin
if CheckBox1.Checked = false then
begin
Form1.ListView1.Items[i].imageindex := 2;
wsh_socket[i].SendStr('/*csh*/:' + #13 + #10 + '锁定学生' + memo1.Lines.Text);
sleep(1);
end
else
begin
Form1.ListView1.Items[i].imageindex := 4;
wsh_socket[i].SendStr('/*csh*/:' + #13 + #10 + '定时锁定' + Edit1.Text + memo1.Lines.Text);
sleep(1);
end;
end;
end;
close;
end;
procedure TLockf.FormShow(Sender: TObject);
begin
Memo1.Lines.Clear;
end;
procedure TLockf.FormActivate(Sender: TObject);
var
i: smallint;
inifile: Tinifile;
inifilename, wshmemo: string;
begin
edit1.Text := '5';
edit1.Enabled := false;
inifilename := ExtractFilePath(Application.EXEName) + 'teacher.ini';
inifile := Tinifile.create(inifilename);
ComboBox1.Items.Clear;
for i := 1 to 8 do
begin
wshmemo := inifile.ReadString('LOCKMEMO', 'Memo' + inttostr(i), '空信息');
ComboBox1.Items.Add(wshmemo);
end;
Inifile.Free;
ComboBox1.ItemIndex := 0;
end;
procedure TLockf.ComboBox1Change(Sender: TObject);
begin
Memo1.Text := ComboBox1.Text;
end;
procedure TLockf.BitBtn3Click(Sender: TObject);
var
p_index: smallint;
inifile: Tinifile;
inifilename: string;
begin
p_index := ComboBox1.ItemIndex;
inifilename := ExtractFilePath(Application.EXEName) + 'teacher.ini';
inifile := Tinifile.create(inifilename);
inifile.WriteString('LOCKMEMO', 'Memo' + inttostr(p_index + 1), Memo1.text);
inifile.Free;
FormActivate(sender);
ComboBox1.ItemIndex := p_index;
end;
procedure TLockf.CheckBox1Click(Sender: TObject);
begin
if checkBox1.Checked = true then
edit1.Enabled := true
else
edit1.Enabled := false;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -