如果我已经有很多页面装满了控件,那么在TPageControl中"插入"页面的最佳方法是什么?假设我想在TabSheet1之前插入一个新页面.
谢谢.
更新:在设计时.
我在XML文件中收到DateTime,如2009-12-14 05:07:38Z.
所以,我认为这是一个错误,但在谷歌搜索后,我发现:
http://www.w3schools.com/Schema/schema_dtypes_date.asp
时区要指定时区,您可以通过在时间后添加"Z"来输入UTC时间的时间 - 如下所示:
09:30:10Z
但是当我在我的XMLMapper中的一个节点中使用DateTime时:我的日期时间是截断的,我只是得到日期.
我需要更多咖啡吗?
管理这个的方法是什么?
谢谢
我试图远程读取二进制(REG_BINARY)注册表值,但我得到的只是垃圾回收.任何想法这个代码有什么问题?我正在使用Delphi 2010:
function GetBinaryRegistryData(ARootKey: HKEY; AKey, AValue, sMachine: string; var sResult: string): boolean;
var
MyReg: TRegistry;
RegDataType: TRegDataType;
DataSize, Len: integer;
sBinData: string;
bResult: Boolean;
begin
bResult := False;
MyReg := TRegistry.Create(KEY_QUERY_VALUE);
try
MyReg.RootKey := ARootKey;
if MyReg.RegistryConnect('\\' + sMachine) then
begin
if MyReg.KeyExists(AKey) then
begin
if MyReg.OpenKeyReadOnly(AKey) then
begin
try
RegDataType := MyReg.GetDataType(AValue);
if RegDataType = rdBinary then
begin
DataSize := MyReg.GetDataSize(AValue);
if DataSize > 0 then
begin
SetLength(sBinData, DataSize);
Len := MyReg.ReadBinaryData(AValue, PChar(sBinData)^, DataSize);
if Len <> DataSize …Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个关于重命名文件的Delphi项目,并且我以某种方式找到了一个正则表达式来匹配文件名的最后一个反斜杠之后的所有字符:[^\\]+$在这个地址:你能在正则表达式中向后读吗?.但我找不到一个正则表达式代码来匹配所有字符前一个反斜杠(路径名).
我找到了以下示例,但无法修改反斜杠和所有字符.
[^/]+(?=/[^/]+$) 使用正则表达式匹配来自url的文件夹名称
我正在使用Delphi 2010
我的正则表达式引擎是正则表达式(NFA)
我的示例字符串是
D:\belgelerD\delphi_projects_renamer\12\test_files\Yeni Metin Belgesi.txt
我希望它匹配
D:\belgelerD\delphi_projects_renamer\12\test_files\
我正在使用EC软件帮助套件(EHS)和Delphi 2010,我试图使用HelpROuter组件显示HTML帮助文件(*.chm)
procedure TfrmMain.Button3Click(Sender: TObject);
begin
//load CHM file here
HelpRouter1.Helpfile:= ExtractFilePath(Application.ExeName) + 'VPUCDS.chm';
HelpRouter1.HelpContent;
end;
Run Code Online (Sandbox Code Playgroud)
它不显示帮助文件.我究竟做错了什么?
在我的应用程序中,我创建了一个关于框,我想知道我是否可以显示动画文本作为信用!文本从对话框的底部到顶部动画.我可以使用哪些组件,或者我应该下载以便在我的关于框中获得一个很好的信用动画文本.
我在使用Idhttp.Get方法时遇到了一些问题.我认为它默认工作在阻塞模式(等待答案转到下一行),但我只是看到它不等待答案转到另一行.我正在使用它与线程,但我认为这不是问题.代码是:
IdHTTP1:= TIdHttp.Create(Application);
IdHTTP1.ConnectTimeout:= 10000;
IdHTTP1.Request.Clear;
IdHTTP1.Request.BasicAuthentication:= true;
IdHTTP1.Request.Username := Username;
IdHTTP1.Request.Password := Password;
try
IdHTTP1.Get(PbxURL); **//this should STOP here and wait for answer don't?**
HttpCode:= IdHTTP1.ResponseCode;
except
on E: EIdHTTPProtocolException do
HttpCode := IdHTTP1.ResponseCode;
end;
if HttpCode=200 then
Memo1.Lines.Append('Valid Get!');
Run Code Online (Sandbox Code Playgroud)
所以,我只是注意到我没有得到正确的HttpCode值,因为在'Get'方法之后,它只是继续执行而不等待'Get'完成.我怎么解决这个问题??
我有ObjectList容器,我想添加一个内部迭代器(访问者模式)实际上我正在尝试确定我的列表中的重复项.
样本:http://pastebin.com/pjeWq2uN
这段代码提供了我正在努力实现的目标.
TFindDuplicatesMethod = procedure(s1, s2: string) of object;
TPersonList = class(TObjectList)
public
procedure Iterate(pMethode: TFindDuplicatesMethod)
end;
procedure TPersonList.Iterate(pMethode: TFindDuplicatesMethod)
var
i: Integer;
begin
for i := 0 to Count - 1 do
pMethode(TMyClass(Items[i]).S1, {But i don't have the second parameter because
it comes from outside of PersonList Ex: OpenDialog.Files[i]})
end;
function FindDuplicate(S1, S2: string): Boolean;
begin
Result := False;
if S1 = S2 then
Result := True;
end;
begin
Files.Iterate(FindDuplicates(S1, S2));
end;
Run Code Online (Sandbox Code Playgroud)
我想知道OOP如何解决这个问题.
提前致谢...
我有一些使用Delphi 2010和XE4构建的应用程序,它们在一个线程中使用Synchronize.我认为在Delphi 2010中将Synchronize引入了Delphi.我的线程运行得很好,所以这不是问题.
我的问题是:有没有办法在Delphi 2010之前与Delphi版本"同步"或者以不同的方式询问它,如何在没有Synchronize的情况下更新这些早期版本的Delphi中的GUI控件?
下面显示的代码是实际代码的子集,以减少此帖子的长度.
type
{ A TThread descendent for loading Images from a folder }
TFolderLoadingThread = class(TThread)
private
{ Private declarations }
AspectRatio: double;
protected
{ Protected declarations }
procedure Execute; override;
public
{ Public declarations }
constructor Create(CreateSuspended: Boolean);
end;
procedure TFolderLoadingThread.Execute;
{ Load images ImageEnView in the thread. }
begin
inherited;
{ Free the thread onTerminate }
FreeOnTerminate := True;
if not Terminated then
begin
{ Set the Progressbar.Max Value }
**Synchronize**(
procedure
begin …Run Code Online (Sandbox Code Playgroud) 我试图通过使用StrToDate方法将日期从字符串转换为TDate,但是当我以yyyy/mm/dd格式传递日期时,它给出了我的错误:'''2013/11/12''是不是有效的日期'.我有什么想法我做错了吗?谢谢
var
newDate: TDate;
begin
newDate := StrToDate(sDate);
end;
Run Code Online (Sandbox Code Playgroud) delphi ×10
delphi-2010 ×10
animation ×1
delphi-2009 ×1
delphi-7 ×1
delphi-xe4 ×1
idhttp ×1
indy ×1
loops ×1
path ×1
regex ×1
text ×1
timezone ×1
tobjectlist ×1
vcl ×1
xml ×1
xmlmapper ×1