嘗試更改表單的高度。在窗體我試圖去改變它給我的錯誤:嘗試更改表單的高度時出錯
"Access violation at address 005B9963 in module 'M1Project.exe. Read of address 0000005C."
在其他形式我可以改變高度精細,它只是這個形式。有誰知道爲什麼會出現這個錯誤? 下面的代碼:
procedure TExamQuestions.RandomQuestionButtonClick(Sender: TObject);
var
gif:TgifImage;
filelocation,temp:string;
i,x,cycle,questionid,length:integer;
questionpool: array [0..81] of integer;
begin
Randomize;
cycle:=random(80)+1;
questionid:= cycle mod x;
currentquestion:=questionpool[questionID];
temp:=inttostr(currentquestion);
if temp='0' then
temp:=inttostr(questionpool[x]);
gif:=TgifImage.Create;
loginmenu.ADOQuery1.SQL.Clear;
loginmenu.ADOQuery1.SQL.Add('SELECT question from examquestions where questionID='+temp+'');
loginmenu.ADOQuery1.Active:=true;
filelocation:=loginmenu.datasource1.DataSet.FieldByName('Question').AsString;
filelocation:=('O:\Subjects\Computing\Year 13 EXEs\DButcher\A2 bant\Project = (\Program\Resources\List\'+filelocation);
gif.loadfromfile(filelocation);
length:=gif.Height;
ExamQuestionPicutre.Height:=length;
background.ClientHeight:=length;
ExamQuestionPicutre.Picture.assign(gif);
examquestions.Height:=length;
end;
您還應該考慮局部變量「length」的另一個名稱,因爲「Length」也是內部函數的名稱。 –