好的,我正在尝试在TScrollBox表面上创建一些自定义数量的TPanel,就像你可以在下面的图像上看到的那样.

为了得到这个,我使用以下代码,并且工作正常.
var
pan: array of TPanel;
maxp, i, x, y: Integer;
...
maxp := 10;
SetLength(pan, maxp);
for i := 1 to maxp do begin
// x is correct value; doesn't cause problem
// y is correct value; doesn't cause problem
pan[i-1] := TPanel.Create(form1);
with pan[i-1] do begin
Width := 100;
Height := 150;
Top := x * 151;
Left := y * 101;
Parent := ScrollBox1;
end;
end;
Run Code Online (Sandbox Code Playgroud)
现在,我有问题将TImage对象放在每个具有相同索引的TPanel中(img [0] - > pan [0],img [1] - > pan …
我正在使用FastMM4来自sourceforge.net的应用程序.所以我FastMM4.pas在开头就添加了使用条款.在应用程序中,我需要运行一个batch文件后,FinalizeMemoryManager;在finalization中unit FastMM4;像这样的
initialization
RunInitializationCode;
finalization
{$ifndef PatchBCBTerminate}
FinalizeMemoryManager;
RunTheBatFileAtTheEnd; //my code here..calling a procedure
{$endif}
end.
Run Code Online (Sandbox Code Playgroud)
然后我的RunTheBatFileAtTheEnd代码是:
procedure RunTheBatFileAtTheEnd;
begin
//some code here....
sFilePaTh:=SysUtils.ExtractFilePath(applicaTname)+sFileNameNoextension+'_log.nam';
ShellExecute(applcatiOnHAndle,'open', pchar(sExeName),pchar(sFilePaTh), nil, SW_SHOWNORMAL) ;
end;
Run Code Online (Sandbox Code Playgroud)
为此,我需要SysUtils,shellapi在fastmm4单元的uses子句中使用.但使用它们就会出现这个消息

但如果我SysUtils,shellapi从使用中删除它的工作原理.我仍然需要安装fastmm4的所有功能,但是SysUtils,shellapi没有安装fastmm4
我有自己的单位,但最终确定是在fastmm4完成之前执行的.
任何人都可以告诉我如何解决这个问题?
编辑 - 1
unit FastMM4;
//...
...
implementation
uses
{$ifndef Linux}Windows,{$ifdef FullDebugMode}{$ifdef Delphi4or5}ShlObj,{$else}
SHFolder,{$endif}{$endif}{$else}Libc,{$endif}FastMM4Messages,SysUtils,shellapi;
Run Code Online (Sandbox Code Playgroud)
我的应用程序
program memCheckTest;
uses
FastMM4,
Run Code Online (Sandbox Code Playgroud)
编辑-2:
(在@SertacAkyuz回答之后),我删除SysUtils …
我得到太多实际参数的错误
Procedure TSub.ReadUsers;
var
iPos , i : integer;
begin
ReadLine;
iPos := 0;
for i := 1 to Counter do
iPos := pos('#',sLine);
arrUsers[i] := copy(sLine, 1, ipos-1);
delete(sLine,1,iPos);//error in this line
iPos := pos('#',sLine);
end;
Run Code Online (Sandbox Code Playgroud) 我有这个代码
label1.Caption:= 'Number is:' + inttostr(random(2) + 1);
Run Code Online (Sandbox Code Playgroud)
但结果我每次都有"1".你能解释我做错了什么吗?
我正在从D7迁移到XE2,并且IDE已经更改了一些DFM文件.
在某些文件中,更改只是一些简单的属性,如删除ItemHeight或添加ExplicitLeft = 0.
但是,在其他文件中,更改比删除整个object声明更大,我可以在将dfm文件与D7进行比较时检查.
当我在XE2中从D7添加DFM的缺失部分时,它会保存而不会出现错误:
未找到TGenReglas类.忽略错误并继续?
我已经检查过,TGenReglas在项目中,我甚至将其文件夹添加到项目路径中,以防万一.
保存并重新打开项目后,我的所有更改都不会保存.
我可以将DFM文件从D7复制到XE2中以解决这个问题或我应该怎么做?
我有几件事有问题:
edit1.text当我点击输入时如何使空白(我认为它应该在onEnter事件上,但不是那么肯定)Edit1.text给数组?尽管如此,我想做的就是:
在编辑中输入名称,单击回车,然后在相同的编辑和以前的名称中输入另一个名称以保存在某个变量或数组中.这甚至可能吗?
我试过procedure TForm1.Edit3Enter(Sender: TObject);但是当我点击进入时没有任何反应.
这一行:
TFileStream.Create(fileName, fmOpenRead or fmShareDenyNone);
Run Code Online (Sandbox Code Playgroud)
如果文件名包含类似ñ 的内容,则丢弃异常
我想messages在我的程序中使用,我有一个问题:我可以在一个中使用消息,class procedure还是可以messages在procedure没有的情况下使用class?
这是我的代码:
const
WM_CUSTOM_TCP_CLIENT = WM_USER + 10;
type
TFeedbackEvent = class
public
class procedure feedback(var msg: TMessage); message WM_CUSTOM_TCP_CLIENT;
end;
Run Code Online (Sandbox Code Playgroud)
Delphi返回以下消息:
[Error] unit.pas(33): Invalid message parameter list
Run Code Online (Sandbox Code Playgroud)
非常感谢你.
如果我一次向服务器发送超过32个请求,则它在apache日志中返回500错误代码.错误信息是
超出最大并发连接数
我正在尝试在Delphi 7中进行血压类别检查,而我刚认识Delphi已有几个星期了。问题是,每当我输入大于120的数字时,标签标题始终显示正常。这是我的代码:
procedure TForm1.Button1Click(Sender: TObject);
var a,b:real;
begin
a:=strtofloat(edit1.Text);
if (a<120) then label1.caption:='optimal'
else if (a>120) then label1.caption:='normal'
else if (a<130) then label1.caption:='normal'
else if (a>130) then label1.caption:='normal high'
else if (a<140) then label1.caption:='normal high'
else if (a>140) then label1.caption:='grade 1 hypertension'
else if (a<160) then label1.caption:='grade 1 hypertension'
else if (a>160) then label1.caption:='grade 2 hypertension'
else if (a<180) then label1.caption:='grade 2 hypertension'
else if (a>181) then label1.caption:='grade 3 hypertension'
end;
end.
Run Code Online (Sandbox Code Playgroud)
可能是一些常见的错误,但我仍然无法自己弄清楚,任何帮助都会有很大帮助,谢谢。
delphi ×10
delphi-7 ×10
conditional ×1
delphi-xe2 ×1
fastmm ×1
if-statement ×1
numbers ×1
random ×1
runtime ×1
split ×1