📄 unit5.pas
字号:
J:=j+1;
for i:=0 to ClientDataSet1.FieldCount-1 do
begin
if i=0 then C:='A';
if i=1 then C:='B';
if i=2 then C:='C';
if i=3 then C:='D';
if i=4 then C:='E';
if i=5 then C:='F';
if i=6 then C:='G';
if i=7 then C:='H';
if i=8 then C:='I';
if i=9 then C:='J';
if i=10 then C:='K';
if i=11 then C:='L';
if i=12 then C:='M';
if i=13 then C:='N';
if i=14 then C:='O';
if i=15 then C:='P';
if i=16 then C:='K';
if i=17 then C:='R';
if i=18 then C:='S';
if i=19 then C:='T';
if i=20 then C:='U';
if i=21 then C:='V';
if i=22 then C:='W';
if i=23 then C:='X';
if i=24 then C:='Y';
if i=25 then C:='Z';
if i=26 then C:='AA';
if i=27 then C:='AB';
if i=28 then C:='AC';
if i=29 then C:='AD';
if i=30 then C:='AE';
if i=31 then C:='AF';
if i=32 then C:='AG';
if i=33 then C:='AH';
if i=34 then C:='AI';
if i=35 then C:='AJ';
if i=36 then C:='AK';
if i=37 then C:='AL';
if i=38 then C:='AM';
if i=39 then C:='AN';
if i=40 then C:='AO';
if i=41 then C:='AP';
if i=42 then C:='AK';
if i=43 then C:='AR';
if i=44 then C:='AS';
if i=45 then C:='AT';
if i=46 then C:='AU';
if i=47 then C:='AV';
if i=48 then C:='AW';
if i=49 then C:='AX';
if i=50 then C:='AY';
if i=51 then C:='AZ';
MsExcelWorkSheet.Range[C+IntToStr(J+1)].Value:=ClientDataSet1.Fields[i].AsString ;
end;
ClientDataSet1.Next;
end;
{+================================================+}
try
deletefile('显示结果.XLS');
MsExcelWorkSheet.SaveAs('显示结果.XLS');
except
MessageDlg('无法保存显示结果.XLS',mtInformation,[mbOK],0);
end;
end
else
begin
showmessage('系统已经检测到你想用EXCEL观看的数据库还没有数据,请先录入数据在用它观看...');
end;
end;
procedure TForm5.N5Click(Sender: TObject);
begin
close;
end;
procedure TForm5.N3Click(Sender: TObject);
begin
Toolbar971.Show;
end;
procedure TForm5.N11Click(Sender: TObject);
begin
Toolbar972.Show;
end;
procedure TForm5.N26Click(Sender: TObject);
begin
Toolbar973.Show;
end;
procedure TForm5.N28Click(Sender: TObject);
begin
Toolbar974.Show;
end;
procedure TForm5.DBGrid1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
{============}
if dbgrid1.EditorMode then
begin
if key=39 then
if (activeControl is TDBGRID) then
with TDBGRID(ACTIVECoNTROL) do
if selectedindex <(fieldcount-1) then
selectedindex :=selectedindex+1
else
selectedindex:=0;
end;
{===============}
if dbgrid1.EditorMode then
begin
if key=37 then
if (activeControl is TDBGRID) then
with TDBGRID(ACTIVECoNTROL) do
if selectedindex >(0) then
selectedindex :=selectedindex-1
else
selectedindex:=fieldcount-1;
end;
{===============}
end;
procedure TForm5.SpeedButton9Click(Sender: TObject);
begin
ClientDataSet1.FIRST;
end;
procedure TForm5.SpeedButton10Click(Sender: TObject);
begin
ClientDataSet1.Last;
end;
procedure TForm5.SpeedButton11Click(Sender: TObject);
VAR
RET: INTEGER;
begin
ret:=application.MessageBox('确定要删除此项数据?','删除选项',MB_OKCANCEL+MB_DEFBUTTON2+MB_ICONQUESTION);
if ret=1 then
begin
IF NOT ClientDataSet1.IsEmpty THEN
BEGIN
ClientDataSet1.Delete;
END;
END;
end;
procedure TForm5.DataSource1DataChange(Sender: TObject; Field: TField);
begin
StatusBar1.Panels[1].text:=inttostr(ClientDataSet1.RecNo);;
end;
procedure TForm5.FormResize(Sender: TObject);
begin
if form4.label2.Caption='false' then
begin
if form5.WindowState= wsMinimized then
begin
mainform.WindowState:= wsMinimized ;
end;
end;
end;
procedure TForm5.Image5Click(Sender: TObject);
begin
with TAboutBox.Create(Self) do
try
ShowModal;
finally
Free;
end;
end;
procedure TForm5.N16Click(Sender: TObject);
begin
if ColorDialog1.Execute then
begin
DBGrid1.Color:=ColorDialog1.Color;
end;
end;
procedure TForm5.FileListBox1Change(Sender: TObject);
var i:integer;
begin
try
if FileListBox1.FileName<>'' then
begin
{===============}
with form5 do
begin
mainform.editor.DataSource:=nil;
mainform.editor.DataField:='';
ClientDataSet1.Close;
ClientDataSet1.LoadFromFile(FileListBox1.FileName);
ClientDataSet1.open;
form4.Label2.Caption:='true';
mainform.close;
{ainform.editor.Enabled:=false}
for i:=0 to form5.ClientDataSet1.FieldCount-1 do
begin
if form5.ClientDataSet1.Fields[i].DataType=ftblob then
begin
{ mainform.editor.Enabled:=true; }
mainform.editor.DataSource:=form5.DataSource1;
mainform.editor.DataField:=form5.ClientDataSet1.Fields[i].FieldName;
form4.Label2.Caption:='false';
mainform.show;
end;
end;
try
ClientDataSet1.First;
ClientDataSet1.Next;
ClientDataSet1.First;
except
end;
form5.Caption:=FileListBox1.FileName;
form4.ListBox1.Items.Strings[1]:=FileListBox1.FileName;
end;
{===============}
end;
except
showmessage('系统无法读取此文件,此文件可能不存在!!');
end;
end;
procedure TForm5.N17Click(Sender: TObject);
begin
if ColorDialog1.Execute then
begin
DBGrid1.Font.Color:=ColorDialog1.Color;
end;
end;
procedure TForm5.SpeedButton1Click(Sender: TObject);
VAR
RET: INTEGER;
begin
if FileListBox1.FileName<>'' then
begin
ret:=application.MessageBox('确定要删除此CDX类型文件?','删除选项',MB_OKCANCEL+MB_DEFBUTTON2+MB_ICONQUESTION);
if ret=1 then begin
try
ClientDataSet1.Close;
deletefile(FileListBox1.FileName);
FileListBox1.Update;
FileListBox1.Refresh;
except
showmessage('系统删除此文件出现意外错误!请检查此文件是否被WINDOWS占用?');
end;
end;
end;
end;
procedure TForm5.SendbtClick(Sender: TObject);
begin
if Uppercase(form4.skyfsjyLabel.Caption)='TRUE' then
begin
showmessage('系统检测到你没有此权限使用此功能!');
exit;
end;
form4.dformctlabel.Caption:='form5';
{=======================================}
dform := Tdform.Create( Application );
try
dform.Show;
dform.Update;
dform.ComboBox1.Enabled:=true;
dform.Edit1.Text:=ExtractFileName(form5.FileListBox1.FileName);
except
end;
{=======================================}
end;
procedure TForm5.FormActivate(Sender: TObject);
begin
form4.enabled:=false;
if Uppercase(form4.skydqjyLabel.Caption)='TRUE' then
begin
showmessage('系统检测到你没有此权限使用此功能!');
close;
end;
end;
procedure TForm5.GFXComboBox1Change(Sender: TObject);
begin
if GFXComboBox1.Text='100%' then
begin
dbgrid1.Font.Size:=9;
dbgrid1.TitleFont.Size:=9;
end;
if GFXComboBox1.Text='25%' then
begin
dbgrid1.Font.Size:=6;
dbgrid1.TitleFont.Size:=9;
end;
if GFXComboBox1.Text='50%' then
begin
dbgrid1.Font.Size:=7;
dbgrid1.TitleFont.Size:=9;
end;
if GFXComboBox1.Text='150%' then
begin
dbgrid1.Font.Size:=16;
dbgrid1.TitleFont.Size:=16;
end;
if GFXComboBox1.Text='200%' then
begin
dbgrid1.Font.Size:=18;
dbgrid1.TitleFont.Size:=18;
end;
end;
procedure TForm5.FormCreate(Sender: TObject);
begin
GFXComboBox1.ItemIndex:=3;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -