首先,为我的英语道歉,我希望我在这里写的是有道理的.现在我的问题.
如何使用TypInfo.GetEnumName()获取Variant 的内容类型的字符串表示形式.我试过以下,没有运气,我得到一个数字表示.
myString := GetEnumName( TypeInfo(TVarType), TVarData(myVar).VType );
Run Code Online (Sandbox Code Playgroud)
谢谢.
我怎样才能使我的代码工作?:)我试图制定这个问题,但经过几次失败的尝试后,我认为你们会更快地发现问题,而不是阅读我的"解释".谢谢.
setCtrlState([ memo1, edit1, button1], False);
Run Code Online (Sandbox Code Playgroud)
_
procedure setCtrlState(objs: array of TObject; bState: boolean = True);
var
obj: TObject;
ct: TClass;
begin
for obj in objs do
begin
ct := obj.ClassType;
if (ct = TMemo) or (ct = TEdit) then
ct( obj ).ReadOnly := not bState; // error here :(
if ct = TButton then
ct( obj ).Enabled:= bState; // and here :(
end;
end;
Run Code Online (Sandbox Code Playgroud) Delphi实现的TFlowPanel控件似乎缺乏C#版本的一个重要特性AutoScroll.
C#控件具有AutoWrap= False和AutoScroll=True行为类似于水平可滚动控件列表.
我怎样才能模仿控件的C#版本的行为?
谢谢,艾琳
PS我知道我可以TScrollBox用来获得这种行为,但TFlowPanel(在非残缺的版本中)允许更多的灵活性.
我试图在DataSnap服务器/客户端之间传输一些大流(~1Mb),但无济于事.我试图理解吉姆蒂尔尼的代码(http://blogs.embarcadero.com/jimtierney/2009/04/06/31461)没有运气,我甚至无法编译代码,因为缺少库,无论如何......
我能够接收的流的最大大小是64k,因此您可以为像我这样的周末程序员提供的任何提示/想法/代码示例都会受到欢迎.谢谢!
我的服务器代码:
function TsrvMethods.getStream(iCount: integer): TStream;
begin
Result := dummyStream('0123456789', iCount);
end;
function dummyStream(sCnt: string; iCount: integer): TStream;
begin
Result := TMemoryStream.Create;
while iCount > 1 do begin
Result.Write(Pointer(sCnt)^, Length(sCnt));
Dec(iCount);
end;
Result.Seek(0, TSeekOrigin.soBeginning);
end;
Run Code Online (Sandbox Code Playgroud)
我的客户端调用代码:
procedure TfrmMain.butStreamClick(Sender: TObject);
var
sStr : TStream;
begin
cycleConnection; //make sure we have an active connection
with TsrvMethodsClient.Create( SQLConn.DBXConnection, False ) do begin
sStr := getStream( Integer(SpinCount.Value) );
Free;
end;
FreeAndNil(sStr);
end;
Run Code Online (Sandbox Code Playgroud) delphi ×4
datasnap ×1
delphi-2009 ×1
delphi-2010 ×1
rtti ×1
stream ×1
tobject ×1
typeinfo ×1
vcl ×1