📄 gnsz.pas
字号:
end
else messagedlg('记录定位失败!',mtwarning,[mbok],0);
bbtt[strtoint(edit6.Text),strtoint(edit1.Text)].Glyph.LoadFromFile(trim(edit4.Text));
end
else
begin
if (edit1.Text<>'') and (edit6.Text<>'') then
if query1.Locate('zxh;cxh',vararrayof([edit6.text,edit1.text]),[]) then
begin
query1.Edit;
query1bz.AsString:='';
query1.Post;
end;
edit4.Text:='';
bbtt[strtoint(edit6.Text),strtoint(edit1.Text)].Glyph:=nil;
image1.Picture.Graphic:=nil;
end;
end;
procedure TgnszForm.Query3FilterRecord(DataSet: TDataSet;
var Accept: Boolean);
begin
// accept:=dataset.FieldByName('lbbm').AsString=lb[strtoint(edit6.Text)];
end;
procedure TgnszForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
query3.Close;
query2.Close;
if query1.Modified then
if messagedlg('按键数据已经改动,保存吗?'+#13+'Yes__保存 No__放弃!',mtwarning,[mbyes,mbno],0)=mryes
then BitBtn1Click(sender);
query1.Close;
end;
procedure TgnszForm.FormCreate(Sender: TObject);
var i,j,k:integer;
begin
gnszForm.Left:=0;
gnszForm.Top:=82;
///
for i:=0 to 49 do
begin
lbtt[i+1]:=Tbitbtn.Create(Self);
lbtt[i+1].Height:=30;
lbtt[i+1].Width:=117;
j:=trunc(i/4);
lbtt[i+1].Top:=1+(lbtt[i+1].Height+1) * j;
j:=i mod 4;
lbtt[i+1].Left:=lbtt[i+1].Width*(j);
lbtt[i+1].Name:='sp_'+inttostr(i+1);
lbtt[i+1].Parent:=scrollbox1;
lbtt[i+1].Caption:='';
lbtt[i+1].OnClick:=lbttClick;
lbtt[i+1].Visible:=true;
for j:=0 to 99 do
begin
bbtt[i+1,j+1]:=Tbitbtn.Create(Self);
bbtt[i+1,j+1].Height:=33;
bbtt[i+1,j+1].Width:=117;
k:=trunc(j/4);
bbtt[i+1,j+1].Top:=1+(bbtt[i+1,j+1].Height+1) * k;
k:=j mod 4;
bbtt[i+1,j+1].Left:=bbtt[i+1,j+1].Width*(k);
bbtt[i+1,j+1].Name:='sp_'+inttostr(i+1)+'_'+inttostr(j+1);
bbtt[i+1,j+1].Parent:=scrollbox2;
bbtt[i+1,j+1].Caption:='';
bbtt[i+1,j+1].OnClick:=bbttclick;
bbtt[i+1,j+1].Visible:=false;
end;
end;
end;
procedure TgnszForm.lbttClick(Sender: TObject);
var i,j:integer;
begin
if activecontrol.ClassType<>Tbitbtn then exit;
if copy(activecontrol.Name,1,3)<>'sp_' then exit;
if ls='' then exit;
if screen.Cursor=crhelp then begin
if edit6.Text='' then exit;
if lbtt[strtoint(edit6.Text)].Caption<>'' then
if messagedlg('撤消'+edit6.Text+' 区 连同按键的设置吗?'+#13+'Yes__撤消 No__保留!'+#13+'请选择!',mtwarning,[mbyes,mbno],0)=mryes then
begin
query1.First;
while not query1.Eof do
begin
if query1zxh.AsInteger=strtoint(edit6.Text) then
begin
bbtt[query1zxh.AsInteger,query1cxh.AsInteger].Caption:='';
bbtt[query1zxh.AsInteger,query1cxh.AsInteger].Glyph:=nil;
query1.Delete;
end
else query1.Next;
end;
lbtt[strtoint(edit6.Text)].Caption:='';
end;
exit;
end;
i:=pos('_',activecontrol.Name);
j:=length(activecontrol.Name);
edit6.Text:=copy(activecontrol.Name,i+1,j-i+2);
j:=strtoint(edit6.Text);
for i:=1 to 100 do
begin
bbtt[j,i].BringToFront;
bbtt[j,i].Visible:=true;
end;
edit1.Text:='';
if edit6.Text<>'' then begin
query3.Locate('lbmc',lbtt[strtoint(edit6.Text)].Caption,[]);
end;
end;
procedure TgnszForm.bbttClick(Sender: TObject);
var st:string;
i:integer;
begin
if (activecontrol.ClassType<>Tbitbtn) or (copy(activecontrol.Name,1,3)<>'sp_') then exit;
if screen.Cursor=crhelp then
begin
Timer1Timer(sender);
exit;
end;
st:=trim(copy(activecontrol.Name,4,6));
i:=pos('_',st);
// rrow:=strtoint(copy(st,1,i-1));
// ccol:=strtoint(copy(st,i+1,3));
edit6.Text:=copy(st,1,i-1);
edit1.Text:=copy(st,i+1,3);
if edit6.Text='' then begin
messagedlg('请选择待定义的区域!',mtwarning,[mbok],0);
exit;
end;
if edit1.Text='' then begin
messagedlg('请选择待定义的按键!',mtwarning,[mbok],0);
exit;
end;
if FontDialog1.Execute then
begin
edit2.Text:=FontDialog1.Font.Name;
edit3.Text:=inttostr(FontDialog1.Font.Size);
label5.Color:=FontDialog1.Font.Color;
bbtt[strtoint(edit6.Text),strtoint(edit1.Text)].Font.Name:=FontDialog1.Font.Name;
bbtt[strtoint(edit6.Text),strtoint(edit1.Text)].Font.Size:=FontDialog1.Font.Size;
bbtt[strtoint(edit6.Text),strtoint(edit1.Text)].Font.Color:=FontDialog1.Font.Color;
if (edit1.Text<>'') and (edit6.Text<>'') then
if query1.Locate('zxh;cxh',vararrayof([edit6.text,edit1.text]),[]) then
begin
query1.Edit;
query1zt.AsString:=FontDialog1.Font.Name;
query1zh.AsString:=inttostr(FontDialog1.Font.size);
query1ys.AsString:=inttostr(FontDialog1.Font.color);
query1.Post;
end
else if bbtt[strtoint(edit6.Text),strtoint(edit1.Text)].Caption<>'' then messagedlg('记录查找失败',mtwarning,[mbok],0);
end;
end;
procedure TgnszForm.BitBtn3Click(Sender: TObject);
var i,j:integer;
ss:string;
begin
moveform:=Tmoveform.Create(self);
for i:=1 to 50 do
begin
if lbtt[i].Caption<>'' then moveform.ComboBox1.Items.Add(inttostr(i)+'__'+ lbtt[i].Caption)
else moveform.ComboBox2.Items.Add(inttostr(i));
end;
if moveform.ShowModal=mrok then
begin
if messagedlg('确实要将'+moveform.ComboBox1.Text+' 移动到 '+moveform.ComboBox2.Text+'号位置吗?'+#13+'Yes_移动,No_不移动!',mtinformation,[mbyes,mbno],0)=mryes then
begin
i:=pos('__',moveform.ComboBox1.Text);
ss:=copy(moveform.ComboBox1.Text,1,i-1);
i:=strtoint(ss);
query1.First;
while not query1.Eof do
begin
if query1zxh.AsInteger=i then
begin
query1.Edit;
query1zxh.AsString:=moveform.ComboBox2.Text;
query1.Post;
end;
query1.Next;
end;
for j:=1 to 100 do
begin
bbtt[strtoint(moveform.ComboBox2.Text),j].Caption:=bbtt[i,j].Caption;
bbtt[strtoint(moveform.ComboBox2.Text),j].Glyph:=bbtt[i,j].Glyph;
bbtt[i,j].Caption :='';
bbtt[i,j].Glyph:=nil;
end;
lbtt[strtoint(moveform.ComboBox2.Text)].Caption:=lbtt[i].Caption;
lbtt[i].Caption:='';
end
end;
moveform.Free;
end;
procedure TgnszForm.DBGrid2DblClick(Sender: TObject);
begin
if edit6.Text='' then exit;
if lbtt[strtoint(edit6.Text)].Caption='' then
begin
lbtt[strtoint(edit6.Text)].Caption:=query3lbmc.Value;
end;
end;
procedure TgnszForm.SpeedButton1Click(Sender: TObject);
begin
if FontDialog1.Execute then
begin
edit2.Text:=FontDialog1.Font.Name;
edit3.Text:=inttostr(FontDialog1.Font.Size);
label5.Color:=FontDialog1.Font.Color;
bbtt[strtoint(edit6.Text),strtoint(edit1.Text)].Font.Name:=FontDialog1.Font.Name;
bbtt[strtoint(edit6.Text),strtoint(edit1.Text)].Font.Size:=FontDialog1.Font.Size;
bbtt[strtoint(edit6.Text),strtoint(edit1.Text)].Font.Color:=FontDialog1.Font.Color;
if (edit1.Text<>'') and (edit6.Text<>'') then
if query1.Locate('zxh;cxh',vararrayof([edit6.text,edit1.text]),[]) then
begin
query1.Edit;
query1zt.AsString:=FontDialog1.Font.Name;
query1zh.AsString:=inttostr(FontDialog1.Font.size);
query1ys.AsString:=inttostr(FontDialog1.Font.color);
query1.Post;
end
else messagedlg('记录查找失败',mtwarning,[mbok],0);
end;
end;
procedure TgnszForm.BitBtn4Click(Sender: TObject);
var zxh,cxh:integer;
begin
if query1.RecordCount>0 then
if messagedlg('自动重新布局会删除原有的布局!'+#13+'您真的要继续吗?',mtwarning,[mbyes,mbno],0)<>mryes then exit;
query1.First;
while not query1.Eof do query1.Delete;
query3.First;
zxh:=1;
while not query3.Eof do
begin
cxh:=1;
query2.First;
while not query2.Eof do
begin
query1.Append;
query1lbbm.AsString:=query2lbbm.AsString;
query1mc.AsString:=query2mc.AsString;
query1ywmc.AsString:=query2ywmc.AsString;
query1dycdbh.AsString:=query2bh.AsString;
query1zxh.AsInteger:=zxh;
query1cxh.AsInteger:=cxh;
query1bz.AsString:='';
query1zt.AsString:='宋体';
query1zh.AsInteger:=12;
query1ys.AsInteger:=-2147483640;
query1.Post;
cxh:=cxh+1;
query2.Next;
end;
zxh:=zxh+1;
query3.Next;
end;
for zxh:=1 to 50 do
for cxh:=1 to 100 do
begin
bbtt[zxh,cxh].Caption :='';
bbtt[zxh,cxh].Glyph:=nil;
end;
query1.Close;
query2.Close;
query3.Close;
FormActivate(sender);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -