📄 selectcase.pas
字号:
unit SelectCase;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, DB;
type
TFormCase = class(TForm)
Panel1: TPanel;
ButtonOK: TButton;
ButtonCancel: TButton;
ButtonReset: TButton;
procedure FormDestroy(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ButtonResetClick(Sender: TObject);
private
LableList:TList;
public
SQLList:TStringList;
ComboList:TList;
Function MakeFace(CollNames,SQLList:TStrings):Boolean;
end;
implementation
uses DataMod, Commfunc;
{$R *.DFM}
Function TFormCase.MakeFace(CollNames,SQLList:TStrings):Boolean;
var
I:Integer;
begin
Result:=False;
with DataMd do
for I:=0 to CollNames.Count-1 do begin
try
LableList.Add(TLabel.Create(Self));
with TLabel(LableList.Items[LableList.Count-1]) do begin
Parent:=Self;
Left:=16;
Top:=16+I*32;
Caption:=CollNames.Strings[i]+':';
end;
ComboList.Add(TComboBox.Create(Self));
with TComboBox(ComboList.Items[ComboList.Count-1]) do begin
Style:=csDropDownList;
Parent:=Self;
Left:=72;
Top:=12+I*32;
Width:=193;
DataMD.OpenPubQuery(SQLList.Strings[i],False);
QueryPublic.First;
while not QueryPublic.Eof do begin
Items.Add(QueryPublic.Fields[0].AsString);
QueryPublic.Next;
end;
end;
Result:=True;
except
raise;
end;
end;
end;
procedure TFormCase.FormDestroy(Sender: TObject);
var
I:Integer;
begin
for I:=0 to LableList.Count-1 do
TLabel(LableList.Items[I]).Free;
for I:=0 to ComboList.Count-1 do
TComboBox(ComboList.Items[I]).Free;
LableList.Free;
ComboList.Free;
SQLList.Free;
end;
procedure TFormCase.FormCreate(Sender: TObject);
begin
LableList:=TList.Create;
ComboList:=TList.Create;
SQLList:=TStringList.Create;
end;
procedure TFormCase.ButtonResetClick(Sender: TObject);
var
I:Integer;
begin
for I:=0 to ComboList.Count-1 do begin
TComboBox(ComboList.Items[I]).Text:='';
TComboBox(ComboList.Items[I]).ItemIndex:=-1;
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -