运行线程后,主窗口只剩下标题栏大小了 ( 积分: 100 )

  • 主题发起人 主题发起人 germchen
  • 开始时间 开始时间
G

germchen

Unregistered / Unconfirmed
GUEST, unregistred user!
但在底下标题栏中点程序标题,窗口又会成最大化,
窗口是这样设置的,主窗口是一普通窗口,在窗口中有一些按钮,当执行一段程序后,这个主窗口就缩小成标题栏大小了,这是怎么样回事?
如其中一段代码:
try
Query:=TADOQuery.Create(nil);
Query.Connection:=ADOConnection1;
Query.close;
Query.SQL.Clear;
Query.SQL.Add('delete * from tb_fj ');
Query.ExecSQL;

Query.close;
Query.SQL.Clear;
Query.SQL.Add('select * from tb_fj ');
Query.open;


Q_data.First;
while not Q_data.eof do
begin
col_num:=Q_data.fieldbyname('col_num').asinteger;
if col_num<=strtoint(combobox3.text) then
begin
Query.append;
Query.fieldbyname('col_num').asinteger:=col_num;
for i:=1 to col_num do
begin
Query.fieldbyname('a'+inttostr(i)).AsString:=Q_data.fieldbyname('a'+inttostr(i)).asstring;
end;
Query.Post;

end
else
begin
j:=0;
k:=0;
repeat
k:=j;
Query.append;
for i:=1 to strtoint(combobox3.text) do
begin
Query.fieldbyname('a'+inttostr(i)).asstring:=Q_data.fieldbyname('a'+inttostr(k+i)).asstring;
end;
Query.Post;
j:=j+1;

until(k+i>=Q_data.FieldByName('col_num').asinteger);
end;
Q_data.next;
end;

pagecontrol1.ActivePage:=tabsheet6;
//先清理列
cn:=dbgrid6.columns.Count;
for i:=0 to cn-1 do
begin
dbgrid6.columns.Delete(0);
end;
{
Query.close;
Query.SQL.clear;
Query.SQL.add('select max(col_num) as v from tb_fj');
Query.Open;
m:=0;
if not Query.Eof then
if not Query.FieldByName('v').IsNull then m:=Query.fieldbyname('v').asinteger; }
m:=strtoint(combobox3.text);
for i:=0 to m-1 do
begin
with DBGrid6.Columns.Add do
begin
Title.Caption:='列'+inttostr(i+1);
FieldName:='a'+inttostr(i+1);
Width:=30;
height:=20;
title.Alignment:=taCenter;
Alignment:=taCenter;
end;
end;

Q_fj.Close();
Q_fj.SQL.clear;
Q_fj.sql.add('select distinct col_num');
for i:=1 to m do
begin
Q_fj.sql.add(',a'+inttostr(i));
end;
Q_fj.sql.add(' from tb_fj order by col_num');

Q_fj.open;

Query.close;
Query.free;
speedbutton17.Enabled:=true;
speedbutton18.Enabled:=true;
speedbutton19.Enabled:=true;

application.MessageBox('数据分解成功', '提示', mb_iconinformation + mb_defbutton1);

{
这是没办法的办法,重设高和宽
form1.Left := 0;
form1.Top := 0;
GetWindowRect(GetDesktopWindow, p);
form1.Width := p.Right;
form1.Height := p.Bottom;}
except
end;


这应该是DBGRID列数重新设置所引起的,但不知道怎么解决
 
问题已经解决,多了
height:=20;
这行代码
 
把分给我加上吧,嘿嘿
 
高,结贴吧,大哥,
 
后退
顶部